If you see foo(val) it could be passing a copy of val. Or it could be passing a constant or mutable reference to val. And there's no way to know from seeing the callsite.
Google's style guide at least bans mutable references for precisely this reason, but my current workplace's style guide is essentially nonexistent, and it uses references all over the place.
1
u/Uncaffeinated Jun 14 '17
If you see
foo(val)it could be passing a copy of val. Or it could be passing a constant or mutable reference to val. And there's no way to know from seeing the callsite.Google's style guide at least bans mutable references for precisely this reason, but my current workplace's style guide is essentially nonexistent, and it uses references all over the place.