Boost logo

Boost :

From: Justin M. Lewis (boost_at_[hidden])
Date: 2003-04-25 14:18:17


Even if you want to argue you don't LIKE out and in/out params, that doesn't
mean other people don't use them. So, working under the assumption that
they ARE used, would you rather see,

f(x, y, z);

or

f(out(x), in_out(y), z);

in the code, so you KNOW at the point of invocation what's going on? The
point here is so that, when you're reading the code later you can see what
the person before you was doing. Obviously if you're the one writing and
designing all of the code, you don't need clarification on what your own
intent was.

----- Original Message -----
From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Friday, April 25, 2003 6:50 AM
Subject: Re: [boost] in/out parameters, coding styles and
maintenance[was:class proposal]

> David Abrahams wrote:
> > > int foo(int &param);
> > >
> > > with
> > >
> > > int foo(in_out_param<int> param);
> > >
> > > provided that the in_out_param had no space/time overhead.
> >
> > Probably not, but I am so uncomfortable with out parameters that I
> > basically always avoid them unless their usage is completely idiomatic
> > (e.g. in some operators like stream insertion << and the obvious
> > assignment variants =, +=, ...). Normally I'll go way out of my way
> > to avoid it.
>
> Same here; other than idiomatic uses, like I said before, the only other
usage I can see is for objects that can't be copied either for technical
reasons (eg no copy constructor or assignment operator) or for practical
reasons (eg slow copy constructor or
> assignment operator).
>
> Noel
> --
> NOTICE: If received in error, please destroy and notify sender. Sender
does not waive confidentiality or privilege, and use is prohibited.
> _______________________________________________
> 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