Re: pointer/ref question
From: Gary (glabowitz_at_comcast.net)
Date: Fri, 27 Feb 2004 23:27:26 -0500
"Leor Zolman" <email@example.com> wrote in message
> On Fri, 27 Feb 2004 20:00:02 -0000, "Paul" <pcr1000011<spam avoider>>
> >Why don't we try to change the phrase 'pass by reference' to something
> >'pass by actual' as it can be spurious.
> >I know I have the habit of saying pass by reference when a pointer is
> >used which is probably not technically correct and could be
> >a bad habit I think and I will try to start using 'pass by actual' or
> >something else.
> I think the phrase "pass by reference" has been grandfathered into C and
> C++ such that it is now indistinguishable, /out of context/, from the
> phrases "pass by address" or "pass by name". So much so, that if I read or
> hear anything like "the function parameter uses pass-by-reference", I've
> gotten scant more information from that as I would have from, "The
> takes a parameter".
> I just went into more detail on this then I thought I was going to in
> another post within this thread, so go see that one (time stamp within
> minutes of this one) for more of my ranting...
I teach it as "pass by value" and "pass a reference" since pass by reference
is already taken!
My "logic" is that when you pass by value, an actual value (copy thereof) is
"passed" to the called function to do with as it pleases.
When you pass a reference, the caller gets the ability to refer to the value
directly using an identifier of its choosing to "refer" to the value
wherever the heck it is.
It's unclear to me if students are getting the difference, however. I never
know if they get anything!