No fall-through for switch (WAS: Re: [Submission] D Slices)

bearophile bearophileHUGS at lycos.com
Tue May 31 15:27:37 PDT 2011


Andrei:

> Currently the best proposed behavior is to only require control flow if 
> there is actual code before it. So adjacent case labels don't require 
> any. Your example code would work unmodified.

We have already discussed a little about this. The basic rule is to require a control flow statement at the end of each case. The special case you refer to is when there are empty case labels. I agree this special case is not going to cause bugs. In general I hate special cases, but now I have changed my mind and I now agree this one is acceptable.
I hope to see such small change to D switches in a short enough time, reducing code breakage too :-)

Thank you for improving D,
bearophile


More information about the Digitalmars-d mailing list