Sujet : Re: C23 thoughts and opinions
De : lew.pitcher (at) *nospam* digitalfreehold.ca (Lew Pitcher)
Groupes : comp.lang.cDate : 02. Jun 2024, 17:51:15
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3i7u3$3bp0v$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
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>,
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.
Or even:
:loop
....
goto loop
ITYM
loop:
/*Stuff happens here */
goto loop;
-- Lew Pitcher"In Skills We Trust"