|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug1772.cpp
Wacknia is attempting to simulate the recording industry where a copy of a recording R is less faithful than the original. Member depth is meant to record the degree of imperfection. But to her surprise the program above is printing "1 1 0" rather than the expected "2 1 0". What's going on? bug1772.cpp lint Output
--- Module: bug1772.cpp (C++)
_
return r;
bug1772.cpp(11) : Info 1772: Assignment operator 'R::operator=(const R &)' is
not returning *this
Reference Manual Explanation
1772 Assignment operator 'Symbol' is not returning *this -- The assignment operator
should return *this. This is to allow for multiple assignments as in:
a = b = c;
It is also better to return the object that has just been modified rather than the argument.
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #647 - October 2007