Mail Archives: djgpp/2001/02/20/15:29:21
from: Johan Henriksson, leadprogrammer @ www.realsoftware.cjb.net
"The individual should be praised for it's struggle, the society
condemned for it's actions" - me 1997 #12035895
----------------------------------------------------------------------------
-------------------
>> I have a warning that says: "control reaches end of non-void function".
What
>> would be some reasons I would get this?
Is there a way to tell GCC stop complaining about this? In some more
advanced cases with return()'s, GCC misses the return and think
it might not happen. Consider this:
...
switch(val)
{ case 1: return(2);
case 2: return(3);
default: return(5);
}
}
I'm not sure but I think this is one of the codesnippets that fool's GCC.
The
solution for removing the complaint is a dummy-return in the end but this
bothers me. Is there a nicer general solution? (yes, the above can easily be
solved by moving the default).
TIA
- Raw text -