This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: missing return value
>>>>> "Joe" == Joe Buck <Joe.Buck@synopsys.COM> writes:
Joe> On Wed, Apr 01, 2009 at 10:18:32AM -0700, Paul Koning wrote:
>> The other day there was a request for a compile error if you do:
>>
>> int foo(void) { }
>>
>> and the answer was "the standard says that this is legal -- after
>> all, you can say 'foo();' so the return value isn't used and it
>> doesn't matter that it's missing".
Joe> I think that the right answer to requests like this is to
Joe> recommend the use of -Wall, which will produce
Joe> foo.c:1: warning: control reaches end of non-void function
Joe> Those who want it to be an error can say "-Wall -Werror".
You're right, thanks.
I thought we had that turned on everywhere but it turned out that
wasn't the case.
paul