
On 2/9/06, Pavel Antokolsky aka Zigmar <zigmar@gmail.com> wrote:
One minor thing, I didn't particularly liked about design is that several method (for example shared_message_queue::receive) return values into variables passed by non-const reference. I don't like this approach - the resulting code is obscure because you can't see from that code, that variable is modified. I think of the the following approaches might result a better client code: 1) Return multiple values (i.e. by using std::pair, boost::tuple) 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.
I'd like to second KevinH on this one; I think that a non-const reference is a much better choice than a pointer. To me, non-const reference means output while a pointer means that the method will be taking ownership of that pointer. ~ Scott