Article View: comp.lang.c
Article #1413Re: p = {1,0,0}
From: David Brown
Date: Tue, 10 Nov 2026 12:57
Date: Tue, 10 Nov 2026 12:57
52 lines
4057 bytes
4057 bytes
On 10/11/2026 13:29, Keith Thompson wrote: > David Brown <david.brown@hesbynett.no> writes: > [...] >> 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.) > > I don't entirely agree. Yes, you can create macros that make C > look like something else (I've done it myself). But any such > macro almost creates a new language that anyone reading the code > has to be familiar with. > > If I see `For(100)`, I have to find out how it's defined *and* > understand the `for(...;...;...)` code that it expands to.8 > > If I thought C would benefit significantly from a Pascal-style for > loop (I don't), I'd want it added as a language feature, not hacked > by multiple incompatible macro definitions, one per project. > For a feature that really is useful, and where the change really does make a big difference to the language, then I agree. A key indicator of that is when people /do/ make multiple incompatible definitions to provide the feature. (Booleans is a prime example for C.) When it is a minor matter that few people even think about, such as the way "for" loops are written in C, then it is entirely unrealistic to imagine it being added to the language. Given that, I think it would be better for bart to make and use a "For" macro in his own C programming (if he does any now), rather than getting annoyed about how "for" works. It would be even better for him to simply use C's "for" /without/ getting annoyed, if that is an option.
Technical Details
Message-ID:
<11cv4c8$25c1j$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> <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> <11cukc4$1vnj7$1@dont-email.me> <11cv2mt$24ofb$1@kst.eternal-september.org>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 13:57:43 +0100
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <11cv4c8$25c1j$1@dont-email.me>
References: <11c7f1j$20b9h$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>
<11cukc4$1vnj7$1@dont-email.me> <11cv2mt$24ofb$1@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 10 Nov 2026 12:57:44 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="2273331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q2S2KAJ2HX2KU8RkNLXvzJoh6pyZty/I="; posting-host="a907b94bf0fcbfeffbc81a62ebe9823d"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uUBzzV5MbatzA2bXAbzkimprsfI= sha256:sGDOL8Pq9b6u4nxUf/gJR/U7bfZacEC7DOYc7I4F7Wc=
sha1:xRZXxXt7fVnZo0jy6GbzbrxRmWU= sha256:gas3iwJ6liqA0dyB3iVUDdJ107lfBlGGBpBnDQXtkvk=
Content-Language: en-GB, nb-NO
In-Reply-To: <11cv2mt$24ofb$1@kst.eternal-september.org>