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

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

 



>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@xxxxxxxxxx] 
Envoyé : jeudi 22 mai 2008 14:09
À : Laurent Dufréchou
Cc : 'Tom Browder'; 'Sven Eschenberg'; gcc-help@xxxxxxxxxxx
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.



[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