According to ISO C++:
The continue statement shall occur only in an iteration-statement and causes control to pass to the loop-continuation portion of the smallest enclosing iteration-statement, that is, to the end of the loop. More precisely, in each of the statements
while (foo) { do { for(;;){ { { { // ... //.... //... } } } contin:; contin:; contin:; } } while (foo); }
a continue not contained in an enclosed iteration statement is equivalent to goto contin
Based on the last part of the quote, I thought that the following would be allowed:
#include <iostream>
using namespace std;
int main() {
continue;
cout << "Will be jumped" << endl;
contin:
}
I thought this will work as a goto statement, jumping to contin
. What did I miss?