Questions tagged [references]

For questions about references, a superset of pointers, which refer to the location of an existing value rather than storing a value independently.

Filter by
Sorted by
Tagged with
1 vote
1 answer
168 views

How does languages distinguish passing a parameter by value and reference, especially with non-parameter direct initializations in consideration?

Background What I want is to make the behaviors of the following two pieces of code identical: specifier x = getX(); doSomething(x); ...
user23013's user avatar
  • 2,258
3 votes
4 answers
248 views

Common postfix representations of pointer/reference operations

In some C-based languages (including C/C++ themselves and Rust), taking pointers/references and dereferencing is done with prefix operators & and ...
abel1502's user avatar
  • 2,497
6 votes
2 answers
235 views

How are C++ style references implemented behind the scenes? Could they be implemented without pointers?

I would not be surprised if C++ style int &y = x; was no more than int *y = &x; behind the scenes and every use of ...
user16217248's user avatar
  • 7,535