goto跳过代码而不调用析构函数和事物是真的吗?
例如
void f() {
int x = 0;
goto lol;
}
int main() {
f();
lol:
return 0;
}
Run Code Online (Sandbox Code Playgroud)
会不会x泄露?
请考虑以下代码:
void foo()
{
{
CSomeClass bar;
// Some code here...
goto label;
// and here...
}
label:
// and here...
}
Run Code Online (Sandbox Code Playgroud)
bar的析构函数会被调用吗?