Remove switch case fallthrough

Paul Backus snarwin at gmail.com
Thu May 13 14:15:39 UTC 2021


On Thursday, 13 May 2021 at 13:28:07 UTC, rempas wrote:
> Yeah yeah I know I know, Code that looks like C should have the 
> same behavior to C. I've asked about that and I got the same 
> answer. But come one! We can make an exception on this one! We 
> don't need that in D as we can add more cases.
>
> I really love the work the contributors do with D but IMO is 
> things like that who really stop D from REALLY going forward in 
> the next level. Doing things just for doing them NEVER helped 
> anyone!

switch case fallthrough is already considered deprecated. If you 
use it, the compiler will produce the following warning:

     Deprecation: switch case fallthrough - use 'goto case;' if 
intended

I'm not sure what the process is for turning a deprecation like 
this into an error (maybe a -preview/-revert switch is needed?), 
but presumably the intent is for that to happen at some point. In 
the meantime, you can do it manually by compiling with the `-de` 
switch, which tells the compiler to give errors instead of 
warnings for deprecations.


More information about the Digitalmars-d mailing list