Few things

BCS BCS at pathlink.com
Wed Aug 8 10:38:21 PDT 2007


bearophile wrote:
>
> 7) From the FAQ: >Many people have asked for a requirement that there be a break between cases in a switch statement, that C's behavior of silently falling through is the cause of many bugs. The reason D doesn't change this is for the same reason that integral promotion rules and operator precedence rules were kept the same - to make code that looks the same as in C operate the same. If it had subtly different semantics, it will cause frustratingly subtle bugs.<
> 
> I agree with both points of view. My idea: calling this statement differently (like caseof) instead of "switch" (like in Pascal), so you can change its semantics too, removing the falling through (you may use the Pascal semantic too).
> 

how about keep switch as is and add "select" with the no fall through.

I wouldn't mind having nothing done about this, but don't change the switch!



More information about the Digitalmars-d mailing list