
Am 03.01.2013 12:47, schrieb Josef Reidinger:
Better fix the compiler to not spew unnecessary warnings.
Well, thats really bad practice. If you want to do it with switch, then there should be something like default: assert(false, "Unknown statement"); //or log or anything that shout loudly enough to notice that there is problem when extending software return NULL;
Reason is, that when you extend program, you should be warned if you forget to modify some use case. In C it is more tricky, as it is not C++ and enum is just constant definition, so it is not easy to check other integer can come to it.
I certainly agree that this piece of code is ugly as hell and probably crap. Anyway, the function that generates the value for the switch statement can only return 3 different values, and all of those are handled in the switch. So the compiler *is* wrong in this case. Even if the code is ugly. -- Stefan Seyfried "If your lighter runs out of fluid or flint and stops making fire, and you can't be bothered to figure out about lighter fluid or flint, that is not Zippo's fault." -- bkw -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org