for(;;)....what is the meaning for this loop...please tell....
clear for loop doubt
Collapse
X
-
Tags: None
-
Unless you are comparing while(true) to something like for(;true;). Which I guess is syntactically a bit closer but conceptually the same as for(;;).Comment
-
Assembly pseudoCode:a: and b: represent addresses in assembly and are not actually instructions. for(;;): a: // start of loop address, first line inside for loop code ...rest of code goto a b: continuation of code. while(true): a: if 0 neq 0 goto b first line of code rest of code goto a b: continuation of code. OR (depending on compiler) goto b: a: first line of code ...rest of code b: if 0 eq 0 goto a continuation of code.
Comment
-
jkmyoung,
I don't think anyone is disputing the difference in assembly. But the quote was:
No, because 'true' is a condition which must continue to be fulfilled for the loop to continue. Whereas with for(;;) some other statement in the body of the loop is required to stop it
which leads me to believe that the original poster of this quote thinks there is a difference in the c/c++. If we are all taking about the differences in assembly then I think we all agree.Comment
Comment