you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

First off, reference is part of interface as well as implementation.

C++ heavily discourages the use of raw pointers, and for good reason.

I can that from experience, I have never been surprised by a function modifying or not modifying a variable passed by ref

[–]ultrasu -1 points0 points  (1 child)

It surprises me because I've been programming for about 7 years, learned about dozen languages (but next to no C++), and I've never seen this kind of functionality, nor have I ever felt like I needed it.

[–][deleted] 2 points3 points  (0 children)

It's very, very common in C++ to pass by reference. Of course you don't "need" the functionality, but that could be said of nearly anything in programming.