for <==> while (an exception)

Guy Harris guy at sun.uucp
Wed Jul 17 17:40:20 AEST 1985


> "while (1) statement"; which is less efficient in most cases as code is
> generated to test if "1" equals "0".

If your compiler generates code to test if "1" equals "0", you don't have a
very good compiler.  The Portable C Compiler generates the same code for
"for(;;)" and "while(1)", and doesn't generate a test for things like
"if(1 == 0)".  I suspect most compilers do the same.

	Guy Harris



More information about the Comp.lang.c mailing list