Hacker News new | ask | show | jobs
by mattgodbolt 4196 days ago
To clarify: this is only for main(), in C++: (see c3.6.1p5 of the standard)

"A return statement in main has the effect of leaving the main function (destroying any objects with auto- matic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing return 0"

It's really best not to get in the habit of not returning from a function though, as in the vast majority of cases, you'll get a random value (well, whatever's in the appropriate register) as the return result, and unless you specifically configure it, most compilers won't even warn you!