Boost logo

Boost :

From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-05-04 06:34:03


Rene Rivera wrote:
>
> [2003-05-04] Noel Yap wrote:
>
> >Rene Rivera wrote:
> >> But I know of at least one need for "out" parameters:
> >>
> >> An asynchronous call that needs to "return" results. But because it's
> >> asynch it can't return it as the result of the call.
> >
> >Good point. OTOH, can't this be considered an in/out parameter since
> >the caller must own the object being set?
>
> Yes, but that's the same as saying that you can consider an in parameter an
> in/out parameter, for the same reason ;-)

You're right. The difference is that the in parameter is const and can
therefore be differentiated from the in/out parameter at the call site.

> The called function has no interest in the previous value of the out
> parameter, if any. And that's what makes it an out parameter, not the
> ownership.

This may be true if you want to be pedantic; I'm not sure since I'm not
a linguist.

The issue of this thread is to be able to tell apart in parameters from
out parameters from in/out parameters for the purpose of being able to
tell from the call site which functions may be changing a variable. I
think treating out parameters in your example as in/out parameters
accomplishes this. Don't you think so?

Noel


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