About switch case statements...

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Nov 15 09:54:02 PST 2009


Chad J wrote:
> So, switch-case statements are a frequent source of nasty bugs.  Fixing
> them (well) requires breaking backwards compatibility.
> 
> Any chance this will happen for D2?
> 
> (This is intended as more of a reminder and simple curiosity than a
> discussion.)

I wish very much that a transferring control flow statement (break, 
return, goto etc.) is required at the end of each case. Then, the rare 
case when you want to break through is easy to implement as goto case 
xxx; and all is good.

Walter's answer to that has put me to silence for good. "But I use 
fall-through all the time!" I then knew the feature will never make it.


Andrei



More information about the Digitalmars-d mailing list