C++ Compiler Error C2362
The code is like this
{
int a;
if( a == 0 )
{
std::string str("some");
goto CLEANUP开发者_Python百科;
}
return;
CLEANUP:
printf("CLEANUP");
}
this is giving me error Compiler Error C2362 initialization of 'identifier' is skipped by 'goto label'
I moved std::string str("some"); after int a; still it is giving me same error
Is it that your:
goto CLEANUP:
Is supposed to be:
goto CLEANUP;
(semicolon not colon)
Compiler Error C2362
http://msdn.microsoft.com/en-us/library/s6s80d9f%28v=vs.80%29.aspx
if( a == 0 )
{
std::string str("some");
goto CLEANUP:
}
should be
goto CLEANUP;
goto CLEANUP:
should be,
goto CLEANUP;
[Also, make sure your code compiles as printf
is not proper at the end]
精彩评论