[Libreoffice] warnig and coding, need a little help on C++

Pierre-André Jacquod pjacquod at alumni.ethz.ch
Thu Nov 25 10:41:46 PST 2010

as I said, still in warm up phase and getting back familiar with C++..
So cleaning is a good exercise.

I got a compiler warning:

filters/binfilter/bf_sw/source/core/para/sw_paratr.cxx:214:26: warning:
'nTemp' may be used uninitialized in this function

for this:

     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 and is a true nop (no operation). And if the compiler
is not nice, I do not know which value has nTemp, i could almost use
random... So for me it seems the two first lines are not needed and even

OK, now the question: what did I missed ?????

Thank for your help

More information about the LibreOffice mailing list