Cppcheck false positive? (eg 'PropEntry::operator=' should return 'PropEntry &')

Lubos Lunak l.lunak at suse.cz
Thu Dec 27 12:22:42 PST 2012


On Thursday 27 of December 2012, Julien Nabet wrote:
> But there are still these:
> [lingucomponent/source/languageguessing/simpleguesser.hxx:43]: (style)
> 'SimpleGuesser::operator=' should return 'SimpleGuesser &'.
> [reportdesign/source/filter/xml/xmlComponent.hxx:37]: (style)
> 'OXMLComponent::operator=' should return 'OXMLComponent &'.
> [reportdesign/source/filter/xml/xmlFunction.hxx:41]: (style)
> 'OXMLFunction::operator=' should return 'OXMLFunction &'.
> [reportdesign/source/filter/xml/xmlGroup.hxx:38]: (style)
> 'OXMLGroup::operator=' should return 'OXMLGroup &'.
> [reportdesign/source/filter/xml/xmlCell.hxx:41]: (style)
> 'OXMLCell::operator=' should return 'OXMLCell &'.
>
> All except first one, return an object instead of a ref to an object. I
> don't know if I can't just put "&" or if it should be investigated.

 http://courses.cms.caltech.edu/cs11/material/cpp/donnie/cpp-ops.html

 But there's of course a small chance that whoever wrote the operator= 
incorrectly not only didn't know how to do it right but also wrote it in a 
way that cleaning it up will uncover another problem (I'm pretty sure I've 
run into such one already).

> First one isn't an assignment but a comparison! Isn't it a little
> dangerous?

 No idea what you mean.

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list