Should the 2.054 feature about warning on implicit fallthrough
bearophile
bearophileHUGS at lycos.com
Wed Sep 14 15:43:41 PDT 2011
Timon Gehr:
> What would you suggest?
At the moment I suggest nothing, because the situation is set.
Case syntax was discussed a lot, by me too. I suggested to differentiate the syntax, not using ".." because in D they denote an interval open on the right.
> 'C switch' means 'jump table'. It does do that perfectly. ;)
C language is full of badly designed parts :-)
> What is your point?
Well, I don't understand the error it gives :-) Are you able to explain it to me?
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
}
}
test.d(10): Error: switch case fallthrough - use 'goto default;' if intended
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list