My Herb Schildt book on C++ says: \"... In C++, if a function is declared as returning a value, it must return a value.\" However, if I write a function wit
§6.6.3/2:
Flowing off the end of a function is equivalent to a return with no value; this results in undefined behavior in a value-returning function.
So it depends on your definition of mandatory. Do you have to? No. But if you want your program to have well-defined behavior, yes.*
*main is an exception, see §3.6.1/5. If control reaches the end of main without a return, it will have the effect of return 0;.