|
Boost : |
From: Pavel Antokolsky aka Zigmar (zigmar_at_[hidden])
Date: 2006-02-11 17:13:27
On 2/9/06, Kevin Heifner <heifner_k_at_[hidden]> wrote:
> I have not had time to look into shmem yet, so my comment is only
> to the above text without looking at the code.
> 2) No, No, No. I strive for pointer free code. A method that
> advertises a non-const reference tells you that it will modify
> the object. A const reference indicates that it will not. A
> function that takes a pointer tells me nothing.
The problem is with calling code - you can no tell if the call is by
const reference or non-const reference, until you find and check
function declaration. And you might not know at all that there is such
possibility. foo(var) give no clue of the possibility of "var" been
modified. In any case it is a controversial point - pointer are bad
because they are pointer and we don't like pointers in clean C++ code,
besides they may take NULL value. Non-const references are obscure in
client code, but really fast, and returning multiple values, are seems
to be the "cleanest" way, but the least efficient.
-- Best regards, Zigmar
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk