Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
kgwxd
60 days ago
|
parent
|
context
|
favorite
| on:
John Carmack on mutable variables
They aren't the same for object references. The reference can't be changed, but the properties can.
Thorrez
59 days ago
[–]
Depends on the language. In C++
const std::vector<int>& foo = bar.GetVector();
foo is a constant object reference cannot have its properties changed (and also cannot be changed to refer to a new object).
std::vector<int>& foo = bar.GetVector();
Is an object reference that can have its properties changed (but cannot be changed to refer to a new object).
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: