#define forever for(;;)

Jeffrey T. Hutzelman jh4o+ at andrew.cmu.edu
Fri Oct 26 02:39:02 AEST 1990


andrew at motto.UUCP (Andrew Walduck) writes:

>>#define ever (;;)
>>#define nothing ;
>>
>>Then you get
>>
>>for ever
>>	{
>>	...
>>	}
> Is this really defined to loop forever?? Does ANSI guarantee this
> behaviour? 
> Just to be safe I'd define ever like:
> #define ever(;1;)
> Just to make the behaviour predictable.
A couple things.  As has been pointed out to me (and I kind of knew
already), the #define ever is not actually very useful.

However, I use for(;;) all the time in place of while(1) with no
problem.  And yes, I believe that it is defined that the loop will loop
forever if the condition is not given.  Some one back me up on this, or
tell me I;m wrong.
-----------------
Jeffrey Hutzelman
America Online: JeffreyH11
Internet/BITNET:jh4o+ at andrew.cmu.edu, jhutz at drycas.club.cc.cmu.edu,
                jh4o at cmuccvma

>> Apple // Forever!!! <<



More information about the Comp.lang.c mailing list