Cppcheck is a static analyzer for C and C++. With C++ code I sometimes see the check returnByReference
warning that
Function ‘foo()’ should return member ‘bar’ by const reference.
Why should I return members by const reference? Why are members different from local variables? What are the pros and cons of changing this?