This is the mail archive of the gcc-bugs@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]

[Bug c/53232] No warning for main() without a return statement with -std=c99


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53232

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-04 15:38:22 UTC ---
I think -Wreturn-type says in C++ it doesn't warn about declaring:
   main() {}
with no return type.  That only applies to C++, so isn't relevant here.

IMHO this isn't a bug because in C99 it's well-defined what happens if you fall
off the end of main, so it would annoy people to issue a warning on perfectly
valid code whenever -Wall is enabled.

But then I rarely use C99 so I don't really care.   If anyone suggested warning
for C++ programs that fall off the end of main I would be upset :)
The fact people might call main() from other functions is a sort-of-convincing
argument to warn about it (calling main isn't allowed in C++).


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