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:00

What is the purpose of an empty for(;;) loop? Can not the exact same thing be accomplished with a while loop?

Actually, come to think of it, what's the use of a for loop anyway? After all,
int i;
for (i = 0; i < 5; i++)
    some_shit();

corresponds to
int i = 0;
while (i < 5){
    some_shit();
    i++;
}

anyway?

Yes, a for(;;) is the same as while(1), but have you ever heard of such a thing as personal taste? I prefer a while(1) myself, but plenty of people prefer for(;;)IHBT

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