Article View: comp.lang.c
Article #1406Re: p = {1,0,0}
From: David Brown
Date: Tue, 10 Nov 2026 08:24
Date: Tue, 10 Nov 2026 08:24
112 lines
5588 bytes
5588 bytes
On 10/11/2026 02:11, bartc wrote:
> 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.
Or look at C. It is not exactly a challenge to have :
#define For(_var, _limit) for (int _var = 0; _var < _limit; _var++)
and then you can write :
For(i, 100)
With a little more effort, you can even make a single macro that could
handle :
For(100) // Automatic anonymous variable
and
For(i, 1, 100) // If you don't want to start at 0
It is ludicrous to get annoyed about the "lack" of a feature in a
language when the language has all you need in order to provide that
feature. (It is fine to say you would /prefer/ if this feature were
available out-of-the-box in C - that's just personal preference.)
(And before you say it, this is not a "workaround". Macros are part of
the language - they are there to be used if the programmer thinks the
resulting code is better. I personally don't think such a "For" macro
would give better code, but my preferences are different from yours.)
>
>> 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
Symbols are fine for things that are used a lot. For rarely used
features, they are hard to remember when either reading or writing the
code. And this would never be used.
>>
>
> So a repeat-N-times loop. Try ntimes 10 {}
#define NTimes(_n) for (int _nnn = 0; _nnn < _n; _nnn++)
>
>> 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.)
>
The big trouble with playing syntax games like Fir is doing (and you are
doing, to a lesser extent) is that it is very easy to write code
snippets as examples, but very difficult to make a complete set of
syntax and grammar rules that are not ambiguous or in conflict with each
other. Fir does not need to consider that at all in his ramblings - he
just lets his cat wander across his keyboard. For a real language for
widespread use, it is far more difficult as you have to consider all
conceivable corner cases or strange usage. (For your languages, Bart,
you have a middle ground - since you are the only user, you can easily
ensure that all users stay away from awkward corner cases. That's
entirely fine for your own use - but it is one of the reasons your
language design does not scale or compare to mainstream languages.
Still, I would far rather work with your choices than Fir's here!)
Technical Details
Message-ID:
<11cukc4$1vnj7$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-mailReferences:
<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> <11ctr0o$1or07$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: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Tue, 10 Nov 2026 09:24:35 +0100
Organization: A noiseless patient Spider
Lines: 112
Message-ID: <11cukc4$1vnj7$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> <11ctr0o$1or07$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 08:24:36 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="2088551"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZnnKoveQrThLojoRe7+yjJES6MvymK+0="; posting-host="a907b94bf0fcbfeffbc81a62ebe9823d"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8GaWPtpqnfVNT5cJtK5PRk765rM= sha256:6hVWRn3g55ER5uH6fgVR7Xt3lY1WtkHYBSHJLx8k+uc=
sha1:q62dTravVVv3yDe4w3t4Otr9zr4= sha256:jNTZo0P7JsH2EbpBnmDuPHXK/ePn7cw3waCd0zgeBOQ=
In-Reply-To: <11ctr0o$1or07$1@dont-email.me>
Content-Language: en-GB, nb-NO