Boost logo

Boost :

From: Bo Persson (bop2_at_[hidden])
Date: 2003-05-01 19:28:12


"Paul A. Bristow" <boost_at_[hidden]> skrev i meddelandet
news:AHEJIHEOOOBMJPAGPLIPEECDDOAA.boost_at_hetp.u-net.com...
> | -----Original Message-----
> | From: boost-bounces_at_[hidden]
> | [mailto:boost-bounces_at_[hidden]]On Behalf Of Justin M. Lewis
> | Sent: Sunday, April 27, 2003 12:14 AM
> | To: Boost mailing list
> | Subject: Re: [boost] in/out parameters, coding styles
> | andmaintenance[was:class proposal]
>
> I've followed this long discussion, but I am left feeling like the
Irishman
> replying to a request for directions "Well, I wouldn't start from here!".
>
> Languages designed using rational thought from good basic premises, like
Ada,
> have explicit in, out and inout parameters. Sadly C++ has growed like
Topsy from
> some dodgy articles of faith.

In Ada you specify the in/out property in the function declaration, not at
each point of call. This is the same in C++ (except for the lack of out
pararmeters).

One of the great advantages of reference parameters over pointers is that
you don't have to write &parameter at each point of call. You specify the
parameter type and calling conventions when you declare a function, not on
each and every call. This is an added level of abstraction.

The "I wouldn't start from here" is close to the point. The OP is trying to
fix the wrong problem, IMO. Instead of adding an indirection to the
parameters, he should refactor the interface to use function names and
parameter names that describe what is actually happening.

Bo Persson
bop2_at_[hidden]


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