This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Enable -Wreturn-type by default ?
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Dodji Seketeli <dodji at seketeli dot org>
- Cc: Sylvestre Ledru <sylvestre at debian dot org>, <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 14 Nov 2013 13:31:37 +0000
- Subject: Re: Enable -Wreturn-type by default ?
- Authentication-results: sourceware.org; auth=none
- References: <5283ABF2 dot 5010209 at debian dot org> <871u2jw776 dot fsf at seketeli dot org>
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