"Rainer Deyke" <rain...@eldwood.com> wrote in message news:hfenkl$ve...@digitalmars.com... > Nick Sabalausky wrote: >> As I mentioned earlier, that should be semantically equivilent to: >> >> int x = 1, y = 1; >> >> if(z == x) >> { ... } >> else if(z == y) >> { ... } >> >> In fact, it's already semantically equivilent to that, except that x and >> y >> are currently required to be known at compile-time. > > I assume the same rule applies to 'goto case'? > > int i = 0, j = 0; > switch (0) { > case i: > goto case j; // Oops, infinite loop. > case j: > // Never reached. > } > > I'm basically in favor of this change - it increases the expressive > power and uniformity of the language at little cost - but corner cases > like this bother me. >
I think that amounts to a computed goto, which I don't think D currently has, so that probably just wouldn't compile. But with or without computerd goto, this sounds like a reason to use an actual fallthrough command instead of "goto case".