Groups | Search | Server Info | Login | Register
Groups > comp.lang.c > #396568
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Loops (was Re: do { quit; } else { }) |
| Date | 2026-02-03 04:21 -0800 |
| Organization | None to speak of |
| Message-ID | <874inyqaq2.fsf@example.invalid> (permalink) |
| References | (16 earlier) <vtmgj8$g81k$1@dont-email.me> <vtn55a$17107$1@dont-email.me> <20250415201754.605@kylheku.com> <87h62o2296.fsf@nosuchdomain.example.com> <86ldhajbfx.fsf@linuxsc.com> |
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
> [...]
>
>> I could write a macro like:
>>
>> #define ITERATE(var, from, to) for ((var) = (from); (var) < (to); (var)++)
>>
>> but then anyone reading the code has to understand both how C-style
>> for loops work and how the ITERATE macro works. Does the expansion
>> use < or <=? What happens if "to" is INT_MAX? Did the author of
>> the macro get everything right?
>
> An advantage of using a macro is that these questions need be
> answered only once, rather than at every place a for() loop
> would appear.
>
>> Now if someone else finds that such a macro makes things easier for
>> them, that's fine. But often, *in my opinion*, such macros make code
>> harder to read for someone who knows C well.
>
> Whether using a macro like ITERATE() makes code harder to read
> or easier to read is a testable proposition, and as such it
> deserves to be treated as a question of fact rather than as
> a matter of opinion.
Did you have anything useful to add? You say it "deserves to be
treated as a question of fact", but you make no attempt to do
so yourself.
You seem to be dredging up old posts of mine (this one is from
about 10 months ago) and finding reasons to complain about them,
usually because the fact that I expressed an opinion bothers you.
I encourage you to knock it off.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Loops (was Re: do { quit; } else { }) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-03 03:47 -0800
Re: Loops (was Re: do { quit; } else { }) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-02-03 04:21 -0800
Re: Loops (was Re: do { quit; } else { }) Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> - 2026-02-04 23:40 +0000
Re: Loops (was Re: do { quit; } else { }) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-02-05 08:10 +0100
Re: Loops (was Re: do { quit; } else { }) Michael S <already5chosen@yahoo.com> - 2026-02-05 11:30 +0200
Re: Loops (was Re: do { quit; } else { }) Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-05 15:21 +0000
csiph-web