Behavior of continue in do/while loops.

Steven Schveighoffer schveiguy at yahoo.com
Wed Sep 12 10:43:26 PDT 2007


"Downs" wrote
> The confusion here stems largely from the way a do/while loop looks -
> the condition is found at the _end_ at the loop body, yet I expected
> continue to jump to the _beginning_.

BTW, usually the compiler re-arranges a while loop so that the condition is 
at the end also.  Looks something like this:

while(condition)
{
...
}

becomes

JMP loop
loopstart:
...
loop:
TST condition ; sets zero flag if condition is true
JNZ loopstart

Actually, I have no idea how to code in assembly, so my code is probably 
worthless, but you get the idea :)

-Steve 





More information about the Digitalmars-d mailing list