On 2/17/2014 6:35 PM, Manu wrote:
If I were to imagine a solution to that problem I would have also applied final switch, but in the case it's dealing with integers and not enums and therefore can't know which values are valid and tell you that you missed one, it should insert an implicit 'default: assert(0);' (since final switch isn't meant to have 'default' cases), this way any case you don't explicitly handle is considered invalid, and you'll catch your mistake immediately. I expect final switch on enum's must do this anyway (at least in debug)? It's possible to receive a value that's not a recognised enum key; what happens in that case? It seems effectively the same to me.
The 'final' works as you propose. Why not give it a whirl?
