Hi Pavel,

I have been hit with this as well. However, I think it is good that this
error appears, even though logically it shouldn't.

For humans who read code, I prefer to have one clear return statement in the
end, if that function has return value.

For that particular function I'd suggest removing the else -line. thus the
"return (GetFunction() == rKeyCode.GetFunction());" becomes the default.

in other situations/functions I'd prefer to have that last return present
some kind of default of that function (e.g. FALSE if none of the tests in
the function work out).

This makes it less likely to introduce unexpected behaviour in complex
functions, when they are changed.

      Mox

On 1/6/07, Pavel Janík <[EMAIL PROTECTED]> wrote:

Hi,

I'd like to make vcl compilable without warnings on Mac OS X and I
found something that I do not know how to fix properly...

/Users/pavel/BUILD/X11/BuildDir/ooo_SRC680_m199_src/vcl/source/app/
svapp.cxx:1715: warning: control may reach end of non-void function
'BOOL KeyCode::IsDefinedKeyCodeEqual(const KeyCode&) const' being
inlined

This function is defined as:

inline BOOL KeyCode::IsDefinedKeyCodeEqual( const KeyCode& rKeyCode )
const
{
        if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc ==
KEYFUNC_DONTKNOW) )
                return (GetFullKeyCode() == rKeyCode.GetFullKeyCode());
        else
                return (GetFunction() == rKeyCode.GetFunction());
}

And in fact the compiler is telling me now that control may reach end
of it. Strange, but true ;-) This is a compiler bug, same/relevant to:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21191
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19699

The question is what to do with it and with my goal to make it
warning free ;-)

The compiler is gcc version 4.0.1 (Apple Computer, Inc. build 5367).

I see several "fixes" to this:

- adding return FALSE; at the end of the inline function

- removing "else"

What solution is the best for you? Do you have cleaner solution for
this?
--
Pavel Janík
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Mox on G

Reply via email to