473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How is a reference represented internally and how does it differ from a pointer

what is internal represtation of reference variable
Oct 11 '07 #1
5 1524
weaknessforcats
9,208 Expert Mod 8TB
A pointer.

Except in this case the pointer is managed by the compiler so there won't be any mistakes made.

The original variable is inbthe stack frame of the calling function. The reference is a pointer in the called functions stack fram back to the original variable. Code is generated to do the address-of on the call and the de-reference as necessary in the called function.

Since this is a generated pointer, you can't change it to point to something else hence the restriction that you can't change the reference once it's established.
Oct 11 '07 #2
what is the use of reference variable when the same work is done using address of (&) and dereference(*) operator
Oct 11 '07 #3
can u show me with help of diagram internal represntation of reference variable?
Oct 11 '07 #4
Banfa
9,065 Expert Mod 8TB
Please do not double post questions and keep all related question about a single topic in a single thread.

Please read the Posting Guidelines .

Banfa
Administrator
Oct 11 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
what is the use of reference variable when the same work is done using address of (&) and dereference(*) operator
Because you make mistakes using & and * and the compiler doesn't.

can u show me with help of diagram internal represntation of reference variable?
Did not not read post #2??? It's a pointer managed by the compiler.
Oct 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: JKop | last post by:
Does that Standard explicitly forbid the initiation of a null reference? Is there anything wrong with the following code?: void Blah( std::string const &k ) { if ( !&k ) return; // work with...
12
by: | last post by:
I know how to use a StringBuilder, which supposedly does not create a new copy of it each time you modify it contents by adding or removing text. But, I wonder how does it do that internally ? I...
18
by: man | last post by:
can any one please tell me what is the diff between pointer and reference.....and which one is better to use ....and why???????
7
by: Xiaoshen Li | last post by:
Dear All, I thought I understood using pointer variables as function parameters. But I failed to understand why it is needed pass-by-reference of a pointer variable. To me, pointer variable...
45
by: bobalong | last post by:
Hi I'm have some problem understanding how JS numbers are represented internally. Take this code for an example of weirdness: var biggest = Number.MAX_VALUE; var smaller = Number.MAX_VALUE...
12
by: Mike | last post by:
Consider the following code: """ struct person { char *name; int age; }; typedef struct person* StructType;
10
by: Dave Cox | last post by:
of "int" in VB? //b=1.2 b=int(b) //b now equals 1
15
by: marydeepthy | last post by:
Hi, I would like to know what happens internally when a c programme is executed. LIke, when we call a function, all the previous values will be pushed on to stack and the local variables of...
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.