About "assignment operators" cppcheck warning

Stephan Bergmann sbergman at redhat.com
Mon Nov 4 02:20:10 PST 2013


On 11/03/2013 10:58 PM, julien2412 wrote:
> Cppcheck reported some cases like this:
> const Player& operator=( const Player& other );<--- 'Player::operator='
> should return 'Player &'.
>
> see http://dev-builds.libreoffice.org/cppcheck_reports/master/3.html#line-36
>
> Here is the explanation about this choice from cppcheck guys:
> https://sourceforge.net/apps/trac/cppcheck/wiki/QuestionsAndAnswers
>
> Do you think we should apply this? Or perhaps there's no general rule?

There appears to be no good reason for the const in this particular 
case, and in general it should be hard to come by a case where there 
would be good reason to do so.

Stephan



More information about the LibreOffice mailing list