On 27/12/2012 19:36, Kohei Yoshida wrote:
On Thu, Dec 27, 2012 at 9:53 AM, julien2412 <serval2412@yahoo.fr
<mailto:serval2412@yahoo.fr>> wrote:
Hello,
Cppcheck reports this kind of thing:
[sd/source/filter/ppt/propread.hxx:116]: (style)
'PropEntry::operator='
should return 'PropEntry &'.
116 const PropEntry& operator=(const PropEntry& rPropEntry);
Indeed, I understand this cppcheck report, if you assign a
variable, the
result can't be considered as "const".
Yes, the assignment operator should always return a non-const
reference of self. Cppcheck is correct on this.
Kohei
Thank you Kohei for your feedback, I pushed 2 commits, see:
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=8068f50276659058ef02958996d8ef84cd89017f
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=a1ff0ec108822d593bb293b6d37a34e6e7c012e5
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.
First one isn't an assignment but a comparison! Isn't it a little dangerous?
Julien
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.