removing default case requirement?

Salih Dincer salihdb at hotmail.com
Sat Apr 1 05:52:58 UTC 2023


On Saturday, 1 April 2023 at 04:51:18 UTC, Paul Backus wrote:
> If the D compiler inserted an implicit `break;` at the end of 
> the first `case` block automatically, then instead of an error, 
> you would get different behavior at runtime. This would make 
> porting C projects to D more error prone.



Paul touched on a very good sub-topic.  Just as the `goto case` 
protects us (this was added recently)), the `default` and the 
`final` duo allow us to choose.  Therefore, if there is a 
`final`, there should be no `break` and `goto case`.

I think 2 modes are enough:
* final and switch
* switch and default

SDB at 79


More information about the Digitalmars-d mailing list