gcc (lack of) return type warnings

Andreas Schwab schwab@suse.de
Wed Feb 14 15:06:00 GMT 2007

Tobias Pflug <tobias.pflug@exorbyte.com> writes:

> This will compile just fine. When compiled with -Wall it will at least
> bring up a warning about the missing return statement in foo(), nothing
> about main tho either. Or is there some standard that implicitly declares
> main to return 0 when there is no explicit return statement?

If the return value of a function is never used then it is perfectly valid
to fall through the end of it.  For main, the default action is to return
0 since C99.


Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

More information about the Gcc mailing list