No more fall through in case statement?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 3 07:43:52 PST 2008
"Janice Caron" wrote
> On 1/3/08, Dan wrote:
>> It's creative, and syntactically coherent. I like it. Even if it breaks
>> my old programs, this one makes sense. : )
>
> I don't think it would break any old programs at all
I haven't done this in any d programs, but in C++ programs, I used to use
braces to create a scope in which to declare a variable. What would happen
here:
case x:
{
int y = 2;
...
}
break;
I'm not super excited about there being such a subtle difference with the
colon (if you automatically put a colon without thinking about it, then the
break statement is required, meaning a very subtle bug), but other than
that, I like the idea. Why not make it more obvious?:
case (x, y, z) // similar to case x: case y: case z:
{
}
/* else case(a, b, c) ? */
-Steve
More information about the Digitalmars-d
mailing list