Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-04-23 13:04:52

>From: "Justin M. Lewis" <boost_at_[hidden]>

> Well, I guess, based on all the code I've been reading at work it didn't
> seem so small, chasing down all kinds of functions across 100's of files
> to see why exactly values are changing mid function I'm looking at
> without warning.
> Anyway, this would allow for stronger enforcement of the rule that
> changing params should be marked somehow. As the programmer of a
> library people are using, I can force them to mark the params they're
> passing as out or in_out, so in 5 years when someone else comes along
> and has to debug it, it's all clear what's happening.

Why not use T & if the function may change it, and const T & if it won't?
Simple and clear. No need to use pointers, to differentiate between it.

An advantage with references is that you may pass by value, or const
reference, and to the caller, it's called in the same way, so the pass by
value or const reference may be an implementation detail.



Boost list run by bdawes at, gregod at, cpdaniel at, john at