Thanks for your bug report. This is not a bug in the compiler, but it
is documented behaviour. The code you write is perfectly correct; a
C++ program is not required to have a return statement in every
function.  In fact, in some cases, it is completely reasonable not to
have any, e.g. when the last function called exits or throws an
exception.

*If* control flow ever falls through the end of a function that needs
to return a value, the behaviour is undefined. GCC offers the
-Wreturn-type option to detect this kind of problem. Of course,
detection cannot be reliable, so the warning is off by default (which
is also documented).

Regards,
Martin


Reply via email to