Groups | Search | Server Info | Login | Register
Groups > comp.lang.c > #396565
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
| Newsgroups | comp.lang.c |
| Subject | Re: Loops (was Re: do { quit; } else { }) |
| Date | Tue, 03 Feb 2026 03:47:30 -0800 |
| Organization | A noiseless patient Spider |
| Lines | 25 |
| Message-ID | <86ldhajbfx.fsf@linuxsc.com> (permalink) |
| References | <vspbjh$8dvd$1@dont-email.me> <vtc7mp$2q5hr$1@dont-email.me> <vtcqf6$3j95s$1@dont-email.me> <vtdh4q$b3kt$1@dont-email.me> <vtf7fe$1qtpg$1@dont-email.me> <vtgfuf$31ug1$1@dont-email.me> <20250413072027.219@kylheku.com> <vtgpce$39229$1@dont-email.me> <vti2ki$g23v$1@dont-email.me> <vtin99$vu24$1@dont-email.me> <vtiuf0$18au8$1@dont-email.me> <vtj97r$1i3v3$1@dont-email.me> <vtl166$36p6b$1@dont-email.me> <vtlcg0$3f46a$2@dont-email.me> <20250415053852.166@kylheku.com> <vtm4ae$6d5j$1@dont-email.me> <H7yLP.2056536$OrR5.1414451@fx18.iad> <vtmgj8$g81k$1@dont-email.me> <vtn55a$17107$1@dont-email.me> <20250415201754.605@kylheku.com> <87h62o2296.fsf@nosuchdomain.example.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Date | Tue, 03 Feb 2026 11:47:38 +0000 (UTC) |
| Injection-Info | dont-email.me; posting-host="72e789f1a61a439ff5daaffc25398413"; logging-data="1520319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hwjyJx1nf72/pxmttt4nfWV9Tk4aZtGE=" |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) |
| Cancel-Lock | sha1:Ytl86hMr5dRdNbMzgihaJRk63UE= sha1:znc37ocJ0iFoMjKX275pdUcTeo0= |
| Xref | csiph.com comp.lang.c:396565 |
Show key headers only | View raw
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.
Back to comp.lang.c | Previous | Next — 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