This is the mail archive of the gcc-help@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: G++/GCC not detetcing stupid errors in code.


Hello Laurent,

On Thu, May 22, 2008 at 01:54:14PM +0200, Laurent Dufréchou wrote:
> [...]
> Any idea about the (not so worrying) no return in function requesting
> return?
> Gcc detect it but not g++. 
> Perhaps I miss another keyword???
> 
> If you've got no idea, I will fill a bug report :)
> [...]
I would expect that this warning does not exist, because omitting the return-statement in
"main" is perfectly valid in C++: (C++-Standard, 3.6.1.3)
"If control reaches the end of main without encountering a return statement, the
effect is that of executing return 0;"

For other functions, g++ also emits a warning if you forget the return
statement.

Axel


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