This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc (lack of) return type warnings
- From: Andreas Schwab <schwab at suse dot de>
- To: Tobias Pflug <tobias dot pflug at exorbyte dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 14 Feb 2007 16:06:04 +0100
- Subject: Re: gcc (lack of) return type warnings
- References: <45D319AB.5010209@exorbyte.com>
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.
--
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."