Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alias variables vs variable references.

Status
Not open for further replies.

denc4

Programmer
Feb 17, 2005
107
0
0
NL
hi,
i have just started out with c++. unfortunately the material that i'm reading does not explain the difference between what it calls alias variables & variable references.
hope somebody knows.

thx.
 
from all my CS classes i believe they are interchangeable but i hear the term references more than i do aliases when programming in C++.

hope this helps
 
I've explored somewhat myself, everything points to the fact that aliases are the same thing as references. To bad though, this is not very consistent. I haven't got his books, but i wonder what Bjarne Stroustrup calls them.
 
I have one of his books that i used as a "reference" no pun intended, but i believe he uses references. It is just one of those things that are not consitent with all programmers but
you must know they mean the same thing. Similarly in the way in java where reference, address (in memory), and pointer all pretty much mean the same thing.
 
I've never heard them called "alias variables" until I read this post. :p
 
i've heard them as "aliases" not alias variables
 
After a little bit of a searching, I found that the alias refers to the new name (variable in the scope of the function) that passed variable takes on while in the function. In other words, just like someone has an alias they slip into and out of while doing certian things. I suppose it's meant to drive home that it's the same peice of memory not a fresh copy in the function's activation record... but personally, I still prefer "pass by reference" or "reference varible" to "creating an alias." Because I think of "creating an alias" as being creating a keyboard shortcut at the command prompt (shell's alias command -- very useful).

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top