🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1401

Re: p = {1,0,0}

#1401
From: bartc
Date: Tue, 10 Nov 2026 01:11
110 lines
4912 bytes
On 09/11/2026 22:47, fir wrote:
> yet maybe some thoughts on for loop syntax potential improvements
> 
> 
> 
> 
> 
> 
> im really annoyed by long c loops
> like for(int i=0; i<100; i++) {}

So am I.

> back hen i miraculously mabe found some good alternative but it needs
> unicode

But there are a million ways to have a shorter syntax without needing to 
resort to Unicode.

Have you looked at /any/ other at languages at all? Take some ideas from 
those.

> 100𝐢 {}  //is alternative for "for(int i=0; i<100; i++) {}"

   for i<100 {}

might do it too. But I'd prefer 'for i=0,100 {}'.

> if f() is a function call then
> 
> f();f();f();f();f();f();f();f();
> 
> resembles loop thus
> 
> f()^10 may be understand as a kinda "natural" form of loop
> 

So a repeat-N-times loop. Try ntimes 10 {}

> so
> 
> int i =0; {a[i++]==0? break} ^ strlen(a);
> 
> might be seen as kinda natural
> (probably thought here strlen would be called many tiles so maybe
> 
> int LEN = strlen(a);
> int i =0; {a[i++]==0? break} ^ LEN;

How you have a loop that iterates over 0 to LEN-1, and yet you still 
have a repeat-N-times loop and need to manually initialise and step the 
index?

Try the idea from above (upper limit is exclusive):

   for i=0,strlen(a) {a[i]==0 ? break}

(I won't comment on that ? construct.)


> its not bad still its a bit long, has no shorter form and also
> there is a problem power has no leftsde form like 2^10 has not a form
> "10th power of 2" though maybe some could vrite ^10 {2}
> 
> so some shortcut form i could consider
> 
> i^100 {tab[i]=0}

   for i=1,100 {tab[i]=0}


> its not quite as natural as  {tab[i++]=0}^100 but maybe its standable as 

What's natural about ^ meaning iteration? In C it means bitwise 
exclusive or. In other languages it might mean pow() or pointer deref.

(Remember your example above was f();f();f() not f()*f()*f().)

> its based on idea of power and adds some to it
> 
> i even noticed this sole sign "^" could be read as "for"
> 
> i^100 would mean power given block  100 times and i treat as a number of 
> this powering
> 
> i^10..99 { tab[i] = 0; }
> 
> ( or { tab[i] = 0; } i^10..99 )

  for i=10,100 {tab[i] = 0}

Everyone can see it is a for loop.


> 
> im not sure if this is enough good but those  two syntaxes
> (one using this unicode indexes in minimal form) and this based on
> ascii is what i'm about currently
> 
> some could be worried that now this i as index is not an "int i"
> only enigmatic i - but im not sure if such special thing as index of the 
> loop (which is kinda low level thing should be necessary a clasical int 
> i..maybe it shouldnt?

A loop index is definitely a thing, just not in C because it is so 
backward. Even Fortran had it in the 1950s:

    do x i=1,100                 # inclusive range

(x is a label for the end of the loop as it didn't have block syntax yet.)
Technical Details
Message-ID: <11ctr0o$1or07$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me> <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me> <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me> <11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me> <11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me> <11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me> <11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me> <11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me> <14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com> <11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me> <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me> <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me> <11ctijh$1mb1u$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: bartc <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Tue, 10 Nov 2026 01:11:51 +0000
Organization: A noiseless patient Spider
Lines: 110
Message-ID: <11ctr0o$1or07$1@dont-email.me>
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me>
 <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me>
 <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me>
 <11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me>
 <11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me>
 <11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me>
 <11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me>
 <11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me>
 <14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com>
 <11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me>
 <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me>
 <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me>
 <11ctijh$1mb1u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 10 Nov 2026 01:11:53 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1862663"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18ORLysrziHhp4v4vrXFt29"; posting-host="4695183c8b99665fc19e8d6c8d0d67a8"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:OXFqEI38YwlJ5twyCAgsLb6VSnk= sha256:eVMMPDQAKHvO0JnVlFEpNxJRXc5PhKTDV89Hh1onx1A=
	sha1:7kmB+894gan2mAjiB8IYbdx8VxU= sha256:psuIUfM4UD9TS9Ppmy5t1iDsIi5zWunSr05Dob+4fRM=
In-Reply-To: <11ctijh$1mb1u$1@dont-email.me>
Content-Language: en-GB