No more fall through in case statement?

Michiel Helvensteijn nomail at please.com
Thu Jan 3 08:03:06 PST 2008


> I like it as it is. If it absolutely has to be changed, why not
> replace the explicit break with an implicit break and make fall-
> through explicit? Liek so:
> 
>    case 1:
>      /*...*/
>      fallthrough; // falls through
>    case 2:
>      /*...*/
>      // no fallthrough -> implicit break
>    case ...
> 
> I could live with that as a compromise...

But the cases are labels. You fall through labels. To change this for
switches would be inconsistent.

Actually, I don't like switch statement syntax at all, really. I don't think
they should be labels. They should be { } blocks.

-- 
Michiel




More information about the Digitalmars-d mailing list