Boost logo

Boost :

From: Justin M. Lewis (boost_at_[hidden])
Date: 2003-05-04 17:50:46


----- Original Message -----
From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Sunday, May 04, 2003 3:47 PM
Subject: Re: [boost] Re: in/out parameters, codingstylesandmaintenance

> "Justin M. Lewis" wrote:
> > Again, you're addressing the specifics of an example, rather than the
idea
> > itself. You can see the point, and you have to realize that in real
life,
> > situations come up where you have an object that can't be copied, but
you
> > still want to use, and pass around to functions.
>
> Again, the point is that out parameters aren't necessary. You and
> others may see a lot of them in your code. IMHO, without seeing the
> rationale behind the decision, the code you see is messy because of the
> out parameters. I also think this is why you're having such a hard time
> tracking down variable changes.
>
> For example:
>
> double d = sqrt( x );
>
> is much easier to comprehend than:
>
> sqrt( x, d );
>
> You seem to want to band-aid the latter with:
>
> sqrt( in( x ), out( d ) );
>

Not at all. I wouldn't use out params for trivial things like that. Out
params are necessary where the cost of copying the object is too expensive,
or where copying the object isn't possible (non-copyable objects,
polymorphic objects, any large object).

> which will, indeed make it a little clearer, but I think it's still not
> better than the former.
>
> Noel
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk