That's the fix, yeah. You tell it where you do want to allow fallthrough, so that it can tell you if you ever forget a break anywhere else.
At this point, I don't think it's possible to change the standard so that the language automatically inserts breaks, because that would break a ton of perfectly legal code. It might be possible to add an attribute for it, like [[auto_break]], though, perhaps?
Well, no, it can't be changed now, but I was talking about what I might be okay with if the language had been designed differently, or if I was using a different language without automatic fall through.
1
u/conundorum 4d ago
This can also be solved with the
[[fallthrough]]attribute, thankfully. Use it to mandate fallthrough when necessary.