Disclaimer: I know it is obscure, and I would not program like that. I am aware of the preferred do-while
statement, rather than that, the question is more about validity of a specific language construct.
Is goto
always supposed to omit conditional expression of the for
loop? From what I observed it skips both the first (i.e. initializing) and second expressions. Will this always happen this way or is this behavior purely compiler dependent?
#include <stdio.h>
int main(void)
{
int m = 5;
goto BODY;
for (m = 0; m < 5; m++)
BODY: puts("Message"); // prints "Message" once
printf("m = %d\n", m); // prints m = 6
return 0;
}