On Apr 8, 12:20=A0pm, Kelsey Bjarnason <kbjarna...@[EMAIL PROTECTED]
> wrote:
> =A0 int x =3D 3, y;
>
> =A0 y =3D func(x);
>
> Quick: what's the value of x?
>
> In C the answer's easy: the value is 3. =A0In C++, there is absolutely
no
> way to know, at the point of calling, what will happen to the variable.
>
> This makes the same code, in C, somewhat easier to read, as the
> indicators of whether the value will be modified or not are right there,
> in your face - or not. =A0In C++, there's no indication whatsoever,
meanin=
g
> you have to hunt for the called function, check its interface, realize
> that yes, it modifies the value and add this to the growing list of
> pointless things to remember which shouldn't need remembering.
ITYM "... realize that yes, it /could modify/ the value ....". Unless
you look at func's definition, one cannot know for sure (just from
checking its interface) if it actually modifies 'x' or not.
- Anand


|