[Libreoffice] [PUSHED] Re: [PATCH] cppcheck cleaning in sc

Caolán McNamara caolanm at redhat.com
Sun Jan 9 13:19:48 PST 2011


On Sun, 2011-01-09 at 16:21 +0100, Julien Nabet wrote:
> Hello,
> 
> Here is a patch for some cppcheck cleaning in sc
> Compiling was ok

Looks good, so pushed. Thanks for this. 

I did decide afterwards to remove two of the methods that cppcheck said
could be "const" seeing as they were actually empty and nothing called
them.

> PS : when cppcheck indicates that a boolean is not initialized, what is 
> recommended to choose ? true, false or it depends on the context ?

Do you have an example, it *might* be a false positive because it might
be an overloaded operator that cppcheck doesn't know about, e.g.

sal_Bool bFoo;
if (aAny >>= bFoo)
{
   //use foo only if Any::operator>>= filled in bFoo successfully
   //cppcheck might think bFoo is used initialized
}

but in the general case sal_False is probably the right value. i.e. in
the above case I'd do sal_Bool bFoo(sal_False); anyway even if it is a
false positive.

C.



More information about the LibreOffice mailing list