Why are reference types and pointers the same in compiled code? (You can see in the third and fourth row). I tried to figure it out, but apparently I could not achieve.
If a variable of a reference type must be initialized in the declaration and cannot be changed, is there a need to take an indirect action, as in pointers?
int x = 10;
mov dword ptr [x], 0Ah
int y = x;
mov eax, dword ptr [x]
mov dword ptr [y], eax
int &i = y;
lea eax, [y]
mov dword ptr [i], eax
int *p = &x;
lea eax, [x]
mov dword ptr [p], eax
p = &i;
mov eax, dword ptr [i]
mov dword ptr [p], eax
x = i;
mov eax, dword ptr [i]
mov ecx, dword ptr [eax]
mov dword ptr [x], ecx
source
share