"Steven Schveighoffer" wrote in message news:op.xbhnw5rbeav7ka@stevens-macbook-pro.local...

It may not be mindless. Most people who want to handle the default case do it. It's usually not so much "I didn't think of handling other values," it's more "I never expect other values to come in, go away annoying compiler error."

So why not put an assert(0) in instead of a break? Tell the compiler that you're assuming there are no other possible values. This is obviously the right thing to do here, and even if you ignore it the compiler _is_ trying to help you.

I think it's the same as saying you have to always have an else clause after an if statement, even if it's "else {}"

If 'if' was primarily used for the same thing that switch is, this would be perfectly reasonable.

Reply via email to