goto (outer) case

Mike James foo at bar.com
Tue Feb 19 02:11:26 PST 2013


I'm feeling the wind from Edsger Dijkstra spinning in his grave...

-=mike=-

"Nick Sabalausky" <SeeWebsiteToContactMe at semitwist.com> wrote in message 
news:20130218205937.00000768 at unknown...
> Consider these nested switches:
>
> ---------------------------
> enum Foo {a, b}
> enum Bar {bar}
>
> auto foo = Foo.a;
> auto bar = Bar.bar;
>
> final switch(foo)
> {
> case Foo.a:
>    final switch(bar)
>    {
>    case Bar.bar:
>        XXXXXX
>        break;
>    }
>    break;
>
> case Foo.b:
>    break;
> }
> ---------------------------
>
> Without adding extra code anywhere else, is there anything I can stick
> in for XXXXXX to get execution to jump to "case Foo.b:"?
>
> Doing "goto case Foo.b;" doesn't work. It just gives a compile error
> that a Foo can't be implicitly converted to Bar.
>
> This ability isn't critical, of course, but it would help clean up some
> code I have.
> 



More information about the Digitalmars-d-learn mailing list