Details on return values and their meaning
Per 3.6.1 ([basic.start.main]
):
A return statement in
main
has the effect of leaving themain
function (destroying any objects with automatic storage duration) and callingstd::exit
with the return value as the argument. If control reaches the end ofmain
without encountering areturn
statement, the effect is that of executingreturn 0;
The behavior of std::exit
is detailed in section 18.5 ([support.start.term]
), and describes the status code:
Finally, control is returned to the host environment. If status is zero or
EXIT_SUCCESS
, an implementation-defined form of the status successful termination is returned. If status isEXIT_FAILURE
, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.