
10 Feb
2006
10 Feb
'06
2:09 p.m.
Pavel Antokolsky aka Zigmar <zigmar@gmail.com> writes:
2) Modify parameters, but instead of passing by non-const reference - pass them by pointer. When pointer passed it immediately indicates that variable might be modified as opposite to non-const reference, which is a rare beast nowadays. If you think of foo(someVar) via foo(&someVar), the second hints about possibility of modifying someVar, while first one doesn't.
One problem with that is that by convention, pointer arguments can be null, whereas the language says there are no legally-formed null references. That said, I agree that "out" parameters should be used sparingly at best. -- Dave Abrahams Boost Consulting www.boost-consulting.com