G++/GCC not detetcing stupid errors in code.
Laurent Dufréchou
laurent.dufrechou@gmail.com
Thu May 22 18:38:00 GMT 2008
>No, it's your knowledge of C++, etc...
>Note that this is a difference between C and C++: in C you must have
>a return value.
Ok! Good, so there is no error in the code due to forced return 0 all is ok
now :)
Will read :
http://www.hep.wisc.edu/~pinghc/isocppstd/basic.html
Thx for the support,
Laurent
-----Message d'origine-----
De : Andrew Haley [mailto:aph@redhat.com]
Envoyé : jeudi 22 mai 2008 14:09
À : Laurent Dufréchou
Cc : 'Tom Browder'; 'Sven Eschenberg'; gcc-help@gcc.gnu.org
Objet : Re: G++/GCC not detetcing stupid errors in code.
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.
More information about the Gcc-help
mailing list