News for hackers. Stuff that matters.
Re:A Tour of C++, 3rd edition (covering C++20 plus a few lik... by Jtsummers on Sunday October 30, 2022 @10:18AM (#33394699)
It shouldn't in C++. Omitting an explicit return (or falling through to the end without hitting another return) should have the same result as if you ended it with `return 0`. If it's returning a random value then that is erroneous behavior. I've also never witnessed this and print non-zero exit codes in my command line prompt (so after execution my prompt looks like `blahblah(EXIT_CODE) $`).

And I just looked it up for C. Since C99, if the return type of `main` is `int` and there is no explicit return (or again you fall through to the end without hitting one) there's an implicit `return 0`. Before C99, undefined.

There are no comments on this comment yet.