Warnings in stl_deque.h
Gerald Pfeifer
pfeifer@dbai.tuwien.ac.at
Wed Sep 23 05:12:00 GMT 1998
On Wed, 23 Sep 1998, Peter Simons wrote:
> > What missing return statement? The above is valid ANSI C++ [...]
> Well, no doubt about that. Arguably, though, it wouldn't hurt if there
> were a warning when compiling with -pedantic. Maybe a small one. :-)
> Falling out of a routine that is supposed to return a value is never a
> good idea, be it main() or not.
Well, but in the case of main() the behaviour is specifically defined by
the languages standard!
My draft copy of the standard has
3.6.1.5 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;
Moreover, -pedantic is probably not what you believe it to be. :-)
>From the egcs documentation:
`-pedantic'
Issue all the warnings demanded by strict ANSI C and ISO C++;
reject all programs that use forbidden extensions.
Valid ANSI C and ISO C++ programs should compile properly with or
without this option (though a rare few will require `-ansi').
However, without this option, certain GNU extensions and
traditional C and C++ features are supported as well. With this
option, they are rejected.
Gerald
--
Gerald Pfeifer (Jerry) Vienna University of Technology
pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/
More information about the Gcc-bugs
mailing list