Ticket #4296: Improve message text for operatorEq
This commit is contained in:
parent
d6888410ec
commit
34d1f885a3
|
@ -1138,7 +1138,9 @@ void CheckClass::operatorEq()
|
||||||
|
|
||||||
void CheckClass::operatorEqReturnError(const Token *tok, const std::string &className)
|
void CheckClass::operatorEqReturnError(const Token *tok, const std::string &className)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::style, "operatorEq", "'" + className + "::operator=' should return '" + className + " &'.");
|
reportError(tok, Severity::style, "operatorEq", "'" + className + "::operator=' should return '" + className + " &'.\n"
|
||||||
|
"The "+className+"::operator= does not conform to standard C/C++ behaviour. To conform to standard C/C++ behaviour, return a reference to self (such as: '"+className+" &"+className+"::operator=(..) { .. return *this; }'. For safety reasons it might be better to not fix this message. If you think that safety is always more important than conformance then please ignore/suppress this message. For more details about this topic, see the book \"Effective C++\" by Scott Meyers."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue