This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Enable -Wreturn-type by default ?


On Thu, 14 Nov 2013, Dodji Seketeli wrote:

> For C, I am not sure about, but I'd find it useful to have that warning
> enabled there too, so I guess I'd like to hear why the warning wasn't
> enabled there by default there as well.

Presumably because C90 allowed return without a value in a function 
returning non-void, as long as the caller didn't use the return value 
(which in turn probably arose because in pre-standard C, people wouldn't 
use a void return type, they'd just omit the return type and let it be 
implicit int).

Return without a value in a function returning non-void, implicit int and 
implicit function declarations are all things removed in C99 for which it 
may now make sense to enable warnings by default.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]