https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116690

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent-gcc at vinc17 dot net

--- Comment #8 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Xi Ruoyao from comment #7)
> In this case -Wall enables -Wreturn-type, and -Wreturn-type clearly shows
> the code is wrong.

Shouldn't the -Wreturn-type warning be enabled by default in C, like in C++?

Even if there are cases where the code may be well-defined, I suppose that this
is regarded as bad programming practice, with more drawbacks (broken code,
possibly hard to debug as the behavior depends on the compiler, optimization
level as seen here, etc.) than advantages (possibly slightly faster code, e.g.
because the compiler does not need to store some explicit value such as 0 in a
register, not noticeable in most cases).

Reply via email to