Re: G++/GCC not detetcing stupid errors in code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Laurent Dufréchou wrote:
> Yeah compiling with g++-4.3 solved the issue of downcasting. I've now a big
> warning :) COOL!
> Thanks Tom.
> 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 :)

No, it's your knowledge of C++.

ISO/IEC 14882:1998(E)
3.5 Program and linkage

"A return statement in main has the effect of leaving the main
function (destroying any objects with automatic storage duration) and
calling exit with the return value as the argument. If control reaches
the end of main without encountering a return statement, the effect is
that of executing

return 0;"

Note that this is a difference between C and C++: in C you must have
a return value.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux