"C" wish list/for(;;) loop
Peter da Silva
peter at graffiti.UUCP
Mon Nov 11 04:04:35 AEST 1985
> One thing that should be changed for consistency reasons is
> to get rid of "for(;;)" meaning "endless loop". This is the
> exception to the equivalence of "for" with "while". And, after
> all, why should a null expression be considered TRUE?
Are you talking about the similarity between this...
for(init;test;increment)
statement;
...and this...
init;
while(test) {
statement;
increment;
}
...?
Let's make init "i=0", test "i<10", increment "i++", and statement "continue".
This gives us...
for(i=0; i<10; i++)
continue;
...and...
i=0;
while(i<10) {
continue;
i++;
}
...for our two statements. The former terminates. The latter doesn't.
--
Name: Peter da Silva
Graphic: `-_-'
UUCP: ...!shell!{graffiti,baylor}!peter
IAEF: ...!kitty!baylor!peter
More information about the Comp.lang.c
mailing list