Goto skips declaration
rikki cattermole
rikki at cattermole.co.nz
Mon Oct 29 03:24:35 UTC 2018
On 29/10/2018 4:22 PM, Michelle Long wrote:
> This should not be an error when the goto jumps outside the current block!
>
> {
> goto Y;
> int x;
> }
> Y:
>
> There is no chance of any local variable being used. This makes it
> impossible to use goto statements in any reasonable way without
> littering the code with brackets.
>
Compiles + runs:
import std.stdio;
void main() {
{
goto Y;
int x;
writeln("booo", x);
}
Y:
writeln("Hello D");
}
Going to need a more complete example.
More information about the Digitalmars-d
mailing list