Is this a bug? +goto

MatheusBN m at gmail.com
Tue Nov 6 00:38:01 UTC 2018


On Tuesday, 6 November 2018 at 00:13:52 UTC, Stanislav Blinov 
wrote:
> But here it's fine:
>
> void main(){
>      {
>          goto Q;
>          S x;
>      } // <---
>      Q:
>      writeln("a");
> }
>
> because goto jumps over both initialization *and* destruction, 
> i.e. neither would even be performed.

I see but at same time I found a bit confusing, because in this 
case we're just adding a new scope to fix the issue, and like I 
said to Jonathan, I thought that "x" wouldn't be initialized 
since it is never used.

Thanks,

MatheusBN.


More information about the Digitalmars-d-learn mailing list