Boost logo

Boost :

From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-04-24 15:50:32


John Swartzentruber wrote:
>
> On Thu, 24 Apr 2003 21:48:02 +0200, Terje Slettebø wrote:
>
> >You must of course do what you think is best in this situation. I just hope
> >you got my point that if the calling code uses const, you don't have to look
> >at the function signature, to determine what variables may or may not be
> >changed by a function.
>
> void func1(Classname& obj)
> {
> func2(obj);
> func3(obj);
> func4(obj);
> }
>
> You are maintaining someone's code and know that one of these functions
> is changing obj. How do you know which? I think I understand your point
> about the calling code using const, but in this case, where the object
> is non-const within the function because func1() changes the object,
> would you call const_cast for the functions that do not change the
> object? I think that would clearly document what is going on, but it
> seems unlikely that anyone does this when passing non-const references
> to functions that take a const references for their parameters. Do you
> do this?

No, I personally don't do this. Do you think anyone would be more prone
to do this if in_out existed?

Noel

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.

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