
On Thu, 03 Jan 2013 10:51:11 +0100 Stefan Seyfried <stefan.seyfried@googlemail.com> wrote:
Am 03.01.2013 04:23, schrieb Cristian Rodríguez:
function has definition
static FdOrFp do_fopen_or_freopen_or_open(int function, const char *path, ...)
at the end there is a comment
/* (No return statement because all cases in the above switch-statement contain one.) */
that's wrong, a non-void function MUST return something, otherwise the compiler can do anything, as it is undefined behaviour.
No, the comment is right. That piece of code is never reached.
add "return NULL" ;)
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. Josef -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org