I caught that I use references not understanding how they really work (that’s why I use them not so often).
Pointer seem to be implemented simply somehow like: a simple WORD variable with address of some other variable. We copy it when we pass it as a parameter to function.
And what happens when we pass reference as a parameter? The same old way?
The two don’t have as much in common as you’d think, really.
A reference exists at a higher level of abstraction in the compiler. It doesn’t need to generate any code at all. It is essentially an alias for an object, so whenever it is used, the compiler treats it as a use of the referenced object. Of course, sometimes, the compiler will choose to represent code which uses a reference by generating a pointer value which can be passed around as needed, but a reference is really not tied to a specific representation.
A pointer is much more close to the metal. It is a variable which stores an address.