removing default case requirement?

Salih Dincer salihdb at hotmail.com
Sat Apr 1 03:25:15 UTC 2023


On Friday, 31 March 2023 at 15:20:41 UTC, Steven Schveighoffer 
wrote:
> Why not? How much does this rule help you, vs. annoy you?

If it wasn't for the final keyword (doesn't exist in many 
languages!), we could discuss this topic. Am I wrong, using 
`final` removes `default`.

If there is a possibility that the `switch` value may not match 
any of the specified cases, you should include a `default` case. 
In this case, you would not use `final switch`, as the 
optimization relies on the assumption that the switch value will 
always match one of the specified cases.

IMO, we should discuss "should the `break` keyword be removed"

SDB at 79




More information about the Digitalmars-d mailing list