Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: C++ more ef...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 44507 of 48022
Post > Topic >>

Re: C++ more efficient than C?

by Anand Hariharan <mailto.anand.hariharan@[EMAIL PROTECTED] > Apr 8, 2008 at 11:35 AM

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
 




 1 Posts in Topic:
Re: C++ more efficient than C?
Anand Hariharan <mailt  2008-04-08 11:35:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:40:53 CDT 2008.