On Thu, 2010-11-25 at 19:41 +0100, Pierre-André Jacquod wrote:
{
sal_Int8 nTemp;
rVal >>= nTemp;
if(nTemp >=1 && nTemp < 0x7f
nLines = (BYTE)nTemp;
}
Well, that's fine for me, nTemp is effectively not initialized. And the
second line is then the same as: rVal = rVal >> nTemp
In my understanding, since nTemps is not initialized, if the compiler is
nice, nTemp is then defaulted to 0 (or NULL). Then rVal = rVal >> 0 make
not a lot of sense
OK, now the question: what did I missed ?????
Heh, this also confuses cppcheck as well. rVal is an "Any" and there is
an overloaded "operator >>=" which operates on that "Any" and nTemp. So
its not anything to do with bit shifting. Read it like...
rVal.ExtractTo(nTemp)
Now, if >>= fails it leaves nTemp untouched. So the general fix is
indeed to initialize nTemp to 0 to clear the warning.
C.
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.