12 ms·
So you get my point. 'x' is not going to be modified behind your back and it's pretty clear on the calling site. In C++ it isn't clear.
by fredmorcos 9y ago
So you get my point. 'x' is not going to be modified behind your back and it's pretty clear on the calling site. In C++ it isn't clear.
- gpderetta 9y agoIt is exactly the same between the two cases: the x object (either the array memory location or the integer memory location) can be changed by 'f' because mentioning the 'x' object name in a function call may implicitly converts to the address of the object, i.e. it passes by reference).
- fredmorcos 9y ago> can be changed by 'f' because mentioning the 'x' object name in a function call may implicitly converts to the address of the object (1) They are two different types and (2) it's clear to you at the calling site!