This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53232] No warning for main() without a return statement with -std=c99
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 04 May 2012 16:09:40 +0000
- Subject: [Bug c/53232] No warning for main() without a return statement with -std=c99
- Auto-submitted: auto-generated
- References: <bug-53232-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53232
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-04 16:09:40 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > IMHO this isn't a bug because in C99 it's well-defined what happens if you fall
> > off the end of main,
>
> Only at program termination (if my interpretation of C99 is correct). Please
> read again the bug report and the links.
I did. Please read the last sentence of comment 4.
> > so it would annoy people to issue a warning on perfectly valid code
> > whenever -Wall is enabled.
>
> Well, GCC has various warnings on perfectly valid code, just because the code
> is suspicious. This is the case here too.
Yes, and in each case some people want it and some don't. I'm pointing out to
Manu the reasons not everyone wants the warning. Your opinion isn't the only
valid one.
> And there are potential portability
> problems (not everyone may use a C99 compiler). So, good reasons to issue a
> warning.
Er, if you want to find portability problems for people not using C99 then
don't use -std=c99. Then -Wreturn-type warns about main.