3 ms·
> What cleanliness? Because you think that > > void f(T *x); > f(&x); > > is not clean? Well, then use C++: > > void f(const T &x); > f(x); To be
by lelanthran 6y ago
> What cleanliness? Because you think that
>
> void f(T *x);
> f(&x);
>
> is not clean? Well, then use C++:
>
> void f(const T &x);
> f(x);
To be honest, the first option is much better for readability. Visual inspection of the caller lets the reader know whether or not f can modify x.
That second option is horrible for the maintenance programmer who is reading the caller; whether or not you are interested in what the function f() does, you need to actually look it up to see if it is allowed to modify x.