|
Boost : |
From: me22 (me22.ca_at_[hidden])
Date: 2006-02-09 19:23:48
On 2/9/06, Sebastian Redl <sebastian.redl_at_[hidden]> wrote:
> Johan Johansson wrote:
> The reason is simple: call-by-reference and call-by-value have no
> visible difference at the call site, which could therefore make changes
> to the arguments unexpected.
>
supposing std::fstream myfile:
int i;
myfile >> i;
myfile << i;
char c;
myfile.get(c);
It's not "myfile >> &i;", nor is it "myfile.get(&c);", and yet you
understand fine.
If I know what a function does--which is hopefully fairly obvious from
its name--then I know which are output parameters, and the & is just
an annoyance. If I don't know what the function does, then I'll have
to look it up in documentation to find out, at which point I'll learn
what the parameters are for. The & might be slightly useful were I
trying divination to figure out what the function does, but even
without that most non-gargantuan functions make it fairly clear which
are output parameters from context.
~ Scott
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk