This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What should -Wmissing-noreturn do with "int main(){exit(0);}" ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]