Assume I have the following function:
// Precondition: foo is \'0\' or \'MAGIC_NUMBER_4711\'
// Returns: -1 if foo is \'0\'
// 1 if fo
In C89 and in C99, the return statement is never required. Even if it is a function that has a return different than void.
C99 only says:
(C99, 6.9.1p12 "If the } that terminates a function is reached, and the value of the function call is used by the caller, the behavior is undefined."
In C++11, the Standard says:
(C++11, 6.6.3p2) "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"