If I call a function, and escape it with a goto, will I be leaking onto the stack? Is that like dividing by zero? Will the universe implode in a reverse-Big-Bang?
This is not my program, but it has almost exactly the same structure…
bool func()
{
blah(1337.1337);
uber("iasouhfia");
if(random) goto escapeLadder;
}
int main(int argc, char* argv[])
{
for(int i = 0; i < 5000000; i++)
{
func();
}
escapeLadder:
return 0;
}
According to draft C++ standard:
“The scope of a label is the function in which it appears.” (6.1 Labeled statement)
So, you can’t
gototo a label outside the function, hence your question contains a syntax error.