Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #385485
| Path | csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
| Newsgroups | comp.lang.c |
| Subject | Re: C23 thoughts and opinions |
| Date | Mon, 03 Jun 2024 13:29:25 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 43 |
| Message-ID | <868qzlojmi.fsf@linuxsc.com> (permalink) |
| References | <v2l828$18v7f$1@dont-email.me> <v2o57g$1t5p4$1@raubtier-asyl.eternal-september.org> <v3dkgh$2e0me$1@dont-email.me> <v3gou9$36n61$3@dont-email.me> <v3hrq7$1o743$1@news.xmission.com> <v3i7u3$3bp0v$1@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Date | Mon, 03 Jun 2024 22:29:26 +0200 (CEST) |
| Injection-Info | dont-email.me; posting-host="df68cad4d9500866e5e56f3de5ab6749"; logging-data="43441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TefgFCDPYTJb937F0GEK7IXJH9ozAd4g=" |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) |
| Cancel-Lock | sha1:eIPpDv5r5aI7Fib8KHkk+q5JZZg= sha1:DD2+5S88F0lB7++oYpOVEZakl2Q= |
| Xref | csiph.com comp.lang.c:385485 |
Show key headers only | View raw
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes: > On Sun, 02 Jun 2024 13:24:23 +0000, Kenny McCormack wrote: > >> In article <v3gou9$36n61$3@dont-email.me>, >> Lawrence D'Oliveiro <ldo@nz.invalid> wrote: >> >>> On Fri, 31 May 2024 17:55:13 -0500, Lynn McGuire wrote: >>> >>>> while (1) >>> >>> Why not >>> >>> while (true) >>> >>> or even >>> >>> for (;;) >>> >>> ? > > I've always considered > for (;;) > preferable over > while (1) > as the for (;;) expression does not require the compiler to expand > and evaluate a condition expression. > > For the for (;;), the compiler sees the token stream <LPAREN> > <SEMICOLON> <SEMICOLON> <RPAREN>, and emits a closed loop, but > with while (1), the compiler sees <LPAREN> <CONSTANT> <RPAREN>, But the 'for (;;)' tokens need to be matched to a much more complicated syntax, with three optional expression (one of which might be a declaration) before assigning semantics. There is actually a lot more to do when 'for (;;)' is used. > and has to evaluate (either at compile time or at execution > time) the value of the <CONSTANT> to determine whether or or > not to emit the closed loop logic. Both gcc and clang turn 'while (1)' into simple loops even under -O0. So it can't be that hard.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar
Re: C23 thoughts and opinions Lynn McGuire <lynnmcguire5@gmail.com> - 2024-05-31 17:55 -0500
Re: C23 thoughts and opinions David Brown <david.brown@hesbynett.no> - 2024-06-01 15:30 +0200
Re: C23 thoughts and opinions Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-02 03:29 +0000
Re: C23 thoughts and opinions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-01 23:31 -0700
Re: C23 thoughts and opinions gazelle@shell.xmission.com (Kenny McCormack) - 2024-06-02 13:24 +0000
Re: C23 thoughts and opinions Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-06-02 16:51 +0000
Re: C23 thoughts and opinions Kaz Kylheku <643-408-1753@kylheku.com> - 2024-06-02 19:52 +0000
Re: C23 thoughts and opinions Michael S <already5chosen@yahoo.com> - 2024-06-03 12:01 +0300
Re: C23 thoughts and opinions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-06-03 13:31 -0700
Re: C23 thoughts and opinions "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-06-03 14:02 -0700
Re: C23 thoughts and opinions gazelle@shell.xmission.com (Kenny McCormack) - 2024-06-03 21:48 +0000
Re: C23 thoughts and opinions David Brown <david.brown@hesbynett.no> - 2024-06-04 10:36 +0200
Re: C23 thoughts and opinions "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-06-04 14:47 -0700
Re: C23 thoughts and opinions bart <bc@freeuk.com> - 2024-06-03 23:43 +0100
Re: C23 thoughts and opinions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-03 16:23 -0700
Re: C23 thoughts and opinions David Brown <david.brown@hesbynett.no> - 2024-06-04 10:47 +0200
Re: C23 thoughts and opinions Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-04 02:20 +0000
Re: C23 thoughts and opinions David Brown <david.brown@hesbynett.no> - 2024-06-04 10:47 +0200
Re: C23 thoughts and opinions Kaz Kylheku <643-408-1753@kylheku.com> - 2024-06-04 05:25 +0000
Re: C23 thoughts and opinions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-06-03 13:29 -0700
csiph-web