News for hackers. Stuff that matters.
Re:“Clean” Code, Horrible Performance by e28eta on Tuesday February 28, 2023 @07:36PM (#34977124)
Depends on the type of code you’re writing. If your `switch` is tightly coupled to the code that defines the cases and they’ll definitely be changed in lockstep, a default is more likely to be harmful.

If your cases are defined externally, and you need to be forwards compatible, omitting a default is wrong.

The Swift language specifically added `@unknown default` for switching over enums.

There are no comments on this comment yet.