Should the 2.054 feature about warning on implicit fallthrough include labels?

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Sep 14 12:22:42 PDT 2011


On 14.09.2011 22:52, simendsjo wrote:
> Not sure if this is a bug or as intended.
>
> import std.stdio;
> void main() {
> int i = 1;
> switch(i) {
> case 0:
> writeln("case 0");
> goto default; // needed here
> default:
> writeln("default");
> // But always falls through here
> aLabel:
> writeln("a label");
> }
> }

Label doesn't affect switch statement in any way, e.g. it's not part of 
case x: synatx, and as such is "fallthrough" like in normal code.
So this part works as intended, though I agree with bearophile there are 
some messy things w.r.t. switch.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list