This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [C++] named return values and return without value warnings


Mark Mitchell <mark@codesourcery.com> writes:

[...]

| In general, there are two approaches to giving warnings like "function
| does not return a value".  One is to rely on the optimizer to find
| paths through the function that yields returns without a value; the
| other is simply to check whether or not the last thing in the function
| is a return statement.  Historically, even outside of GCC, back-end
| folks tend to prefer the former (claiming it is more accurate);
| front-end folks tend to prefer the latter (claiming it is simpler and
| more intuitive), and that the "false positives" often really do
| indicate problems.  (Example:

Wouldn't it be possible to have the wins of both worlds?  That is if
then front-end already warns about the construct then the back-end has
nothing to do.  Conversely the back-end may attempt to see if it could
apply its own rules in case the front-end was unable to detect the
offending construct.

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]