This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
- To: Jason Merrill <jason at cygnus dot com>
- Subject: Re: What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
- From: Andreas Schwab <schwab at suse dot de>
- Date: 16 Aug 1999 10:16:37 +0200
- Cc: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>, rth at cygnus dot com,egcs-patches at egcs dot cygnus dot com, egcs at egcs dot cygnus dot com
- References: <199908142314.TAA17260@caip.rutgers.edu> <u9pv0oonf2.fsf@yorick.cygnus.com>
Jason Merrill <jason@cygnus.com> writes:
|> >>>>> Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:
|>
|> > Well think about what one would need to do to silence the
|> > warning. Is it useful to declare `main' as noreturn?
|>
|> If it doesn't return, it doesn't return. Calling exit bypasses the return
|> from main. It doesn't make much sense to me, stylistically; I'd suggest
|> changing the exit call to a return statement
Returning from main and exit are two different things in some cases (think
about setvbuf with the buffer allocated on the stack).
Andreas.
--
Andreas Schwab "And now for something
schwab@suse.de completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg