#define forever for(;;)

Henry Spencer henry at zoo.toronto.edu
Tue Oct 23 09:07:06 AEST 1990


In article <250 at motto.UUCP> andrew at motto.UUCP (Andrew Walduck) writes:
>>#define ever (;;)
>>for ever
>>	{
>>	...
>Is this really defined to loop forever?? Does ANSI guarantee this
>behaviour? 

It has been a property of C since the start that "for (;;) <statement>"
is an infinite loop.  ANSI, naturally, has reaffirmed this.

Incidentally, "#define ever (;;)" is a habit that most C programmers
grow out of.  It adds nothing to the readability and tends to confuse
auxiliary tools like paragraphers and cross-referencers.
-- 
The type syntax for C is essentially   | Henry Spencer at U of Toronto Zoology
unparsable.             --Rob Pike     |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list