corner case with labled break

Jason House jason.james.house at gmail.com
Sun Jan 27 07:22:09 PST 2008


Shouldn't the code be:

|void main()
|{
|foo: while(true)
|break foo;   // works
|
|bar: switch(6)
|{
|case 5:
|while(true)
|break bar;   // fails
|
|case 6:
|goto case 5;  // works
|
|}
|}

With embedded switches, "case 5" isn't always unique.  Also, the "break case
5" syntax almost implies to me that it should return to case 6.  I hope
that's not what you wanted...


More information about the Digitalmars-d-learn mailing list