What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
Andreas Schwab
schwab@suse.de
Tue Aug 31 23:20:00 GMT 1999
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
More information about the Gcc
mailing list