Home > Back-end >  Is quoted in the internal implementation, is actually a pointer in disguise?
Is quoted in the internal implementation, is actually a pointer in disguise?

Time:09-23

Void f1 (int & amp; A)
{
+;
}
Internal is actually true,
Void f2 (int * b)
{
(* b) + +;
}
Excuse me function reference parameters, exactly?
Alias is coming a variable, or incoming is actually a pointer, but is actually dereferencing the pointer in the function,

CodePudding user response:

Reference parameters are changed, relative to the value and the value of variable and pass the address of the argument, the actual incoming is a pointer to the argument

CodePudding user response:

The concept of references is to compile time, the underlying implementation or pointer

CodePudding user response:


F1 and f2 function code, there is no difference;
Reference is just an alias, without reference to assembly level

CodePudding user response:

Actually also cannot use the f1 f2 to equivalent, you can print two parameters, respectively, in f1 and f2 address see printf (" % p ", & amp; B), f1 is to print is the address of the argument, f2 print address is within the stack parameters,

CodePudding user response:

The concept of reference or pointer is grammar level
Itself does not necessarily reflect in assembly
  • Related