|
|
|
|
|
by chartreusek
2752 days ago
|
|
Since the article is talking about C/C++ In C reaching the end of a non-void function is not undefined behaviour though. It's equivalent to ending with a return; However attempting to use the return value of that function is undefined behaviour. It'd be fine to have that warning be an error when compiling for C++, but not for C. C89 3.6.6.4 (http://port70.net/~nsz/c/c89/c89-draft.html#3.6.6.4):
"If a return statement without an expression is executed, and the value of the function call is used by the caller, the behavior is undefined. Reaching the } that terminates a function is equivalent to executing a return statement without an expression." |
|