This is the mail archive of the gcc-patches@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);}" ?


>>>>> 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


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