This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 15 Aug 1999 12:26:41 -0700
- Cc: 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>
>>>>> 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, but declaring main noreturn
would also work.
Jason