I was wondering, in the following code :
{
int i = 42;
goto end;
}
end:
What is the status of the symbol i when we reach end: (what would we see in a debugger) ? Does it still exist, even if we're out of the scope ? Is there a standard behavior or is it compiler-dependent ?
For the sake of the example, let's assume that the code is compiled using gcc with debug symbols.
Subsidiarily, is the behavior the same in C++ ?
Thank you.
A variable that has been declared in a block will "live" only in that block (it does not matter if you used goto or not).
This behavior is the same in c++