Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Empty for loop

Name: Anonymous 2009-03-14 16:40

I just came across a for(;;) while reading through MSDN on winsock.

What is the purpose of an empty for(;;) loop? Can not the exact same thing be accomplished with a while loop? Seems like tomayto-tomahto to me. If there is some significant purpose though, I'd much like to know.

Name: Anonymous 2009-03-14 17:04

>>7
Yes, a for(;;) is the same as while(1)
No, for(;;) avoids checking that 1 is true.  (Some compilers are said to not optimize that away.)

>>4
while( counter < 3 )
for(;;) is primarily used for infinite loops.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List