"Rainer Deyke" <rain...@eldwood.com> wrote in message news:hfeu0m$1af...@digitalmars.com... > Nick Sabalausky wrote: >> "Rainer Deyke" <rain...@eldwood.com> wrote in message >> news:hfenkl$ve...@digitalmars.com... >>> I assume the same rule applies to 'goto case'? >> >> I think that amounts to a computed goto, which I don't think D currently >> has, so that probably just wouldn't compile. > > So case labels could be variables but labels for 'goto case' would be > constant? That seems backwards and inconsistent.
I guess I don't see it as inconsistent because I don't see case labels quite so much as goto labels but moreso as just an (awkward) syntax for pattern matching. > It also fails to > address this: > > int i = 0, j = 0; > switch (j) { > case i: > break; > case j: > // Never reached. > } > I don't see why it would need to. Switch compares values, not identifiers. If that needed to be addressed, then this would also need to be addressed: int i = 0, j = 0; if(j == i) {} else if(j == j) { /+ never reached +/ } And maybe you could argue that does need to be addressed too, but at that point it's no longer an issue of switch accepting or rejecting run-time values. >> But with or without computerd goto, this sounds like a reason to use an >> actual fallthrough command instead of "goto case". > > Not really. If you want fallthrough, use 'goto case' without a label, > like this: > > goto case; > Ahh, yea, good point. Does that currently work?