Should the 2.054 feature about warning on implicit fallthrough	include
    bearophile 
    bearophileHUGS at lycos.com
       
    Wed Sep 14 12:11:08 PDT 2011
    
    
  
simendsjo Wrote:
> Not sure if this is a bug or as intended.
The semantics of switch is a mess (example: see http://d.puremagic.com/issues/show_bug.cgi?id=3820 ).
Mixing labels and switch cases seems a good way to create a bigger mess.
If I invert some things in your code I get an error...
import std.stdio;
void main() {
     int i = 1;
     switch(i) {
         case 0:
             writeln("case 0");
             goto default; // needed here
         aLabel:
             writeln("a label");
         default:
             writeln("default");
             // But always falls through here
     }
}
Bye,
bearophile
    
    
More information about the Digitalmars-d-learn
mailing list