[net.lang.c] "C" wish list/for

devine@asgb.UUCP (Robert J. Devine) (11/08/85)

  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?

  Yeah, I know, breaking existing code and all that....

Bob

peter@graffiti.UUCP (Peter da Silva) (11/10/85)

>   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