Goto skips declaration
MatheusBN
m at gmail.com
Sun Nov 4 22:09:31 UTC 2018
On Saturday, 3 November 2018 at 20:04:40 UTC, Rubn wrote:
> If that isn't the issue, then actually give a runable source
> example with the associated error that it produces.
I'm not the OP, but I could reproduce!
Example 1 - Problem:
void main(){
goto Q;
int x;
Q:
writeln("a");
}
Error: source_file.d(4): Error: goto skips declaration of
variable source.main.x at source_file.d(5)
Example 2 - Now if you add brackets:
void main(){
{
goto Q;
int x;
}
Q:
writeln("a");
It will work.
MatheusBN.
More information about the Digitalmars-d
mailing list