devxlogo

February 9, 1998

Passing unmodifiable arguments as constobjects

Passing large objects by value as function arguments is very inefficient. On the other hand, passing them by reference/address is dangerous since it enables the callee to change its arguments

Prefer References Over Pointers

Even experienced C++ programmers who have prior experience with C tend to use pointers excessively whereas references may be a better choice. Pointers may result in bugs like the following: