You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The return code from main using libsupcxx is not the same as calling exit, at least in linux-x86_64-libsupcxx . Specifically, sys::exit(1) (which calls the C function exit(1)) causes a shell exit status of 1, whereas "return 1;" from an initial call to main leads to a shell exit status of 0.
Note, the C standard says:
5.1.2.2.3 Program termination
If the return type of the main function is a type compatible with int, a return from the
initial call to the main function is equivalent to calling the exit function with the value
returned by the main function as its argument.
The text was updated successfully, but these errors were encountered:
return n; from main results in an exit status of 0 for all n
running off the end of main correctly results in an exit status of 0
calling std::exit(n) results in a exit status of 1 for all n (including 0)
I quick look at the code, and a simple test case suggests also that functions registered with std::atexit() are only called if std::exit is not called.
The return code from main using libsupcxx is not the same as calling exit, at least in linux-x86_64-libsupcxx . Specifically, sys::exit(1) (which calls the C function exit(1)) causes a shell exit status of 1, whereas "return 1;" from an initial call to main leads to a shell exit status of 0.
Note, the C standard says:
5.1.2.2.3 Program termination
initial call to the main function is equivalent to calling the exit function with the value
returned by the main function as its argument.
The text was updated successfully, but these errors were encountered: