Immutable + goto?

Gide Nwawudu gide at btinternet.com
Thu Mar 19 13:27:33 PDT 2009


On Thu, 19 Mar 2009 21:01:40 +0200, Max Samukha
<samukha at voliacable.com.removethis> wrote:

>Then this is a really weird behavior:
>
>void main()
>{
>start:
>    //int j = bar;
>    scope(exit)
>        writefln("exit");
>    writefln(bar);
>    bar++;
>    if (bar == 10)
>        return;
>    goto start;
>}
>
>scope(exit) is not called at all when the local is commented out and
>called 10 times, otherwise. This implicit scope looks more like a bug
>or misfeature to me. Not calling scope(exit) if there is no variable
>declared is definitely a bug.

See below, added comment.
http://d.puremagic.com/issues/show_bug.cgi?id=1087

Gide



More information about the Digitalmars-d mailing list