This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Control reaches end of non-void function: why only a warning?
Dixit Ryan Mansfield (2005-11-15 13:15):
> > But that seems relatively rare, and I for one would not mind being
> > forced to add a dummy return statement after the call to exit().
> > The benefit of having a more rigorous compiler would outweigh this
> > slight inconvenience.
>
> If you want to be forced then turn the warning into an error
> with -Werror
Not a bad idea, but in many situations, I am compiling a large
project whose code generates many warnings, and turning them all
into errors would be unworkable.
I have patched my copy of the gcc sources to turn this warning
into an error, but I'm still curious to see an example of when it
is useful to knowingly allow the control flow to leave a function
with an undefined return value.
--
Pierre Sarrazin <sarrazip at sympatico dot ca>