hit counter

Timeline

My development logbook

Item 23: Don't Try to Return a Reference When You Must Return an Object

Example:

operator* and operator+ should return a new object instead of a reference. The latter approach will introduce problem such as memory leak

Additional note:

Avoid overloading short-circuiting operators: x || y or x && y. The overloaded versions of these do not short-circuit — they evaluate both operands even if the left-hand operand “determines” the outcome, so that confuses users.

From

C++ FAQ