3 ms·
Pass by reference was a mistake. Doesn’t need to exist. Obscures what’s actually happening at the call site. Overloads the minds of programmers with an unnecess
by foooorsyth 2y ago
Pass by reference was a mistake. Doesn’t need to exist. Obscures what’s actually happening at the call site. Overloads the minds of programmers with an unnecessary third option, which causes bugs like this. Some other non-null indicating syntax for pass by pointer (visible at call site) would’ve made more sense.
I feel exactly like the author. I get less comfortable with C++ year after year, despite writing it all day. I feel like a race car driver who was once confident but has now gotten into too many big crashes.
- avidphantasm 2y agoI feel similarly, but come at it from a different angle. I first learned C++ in undergrad ca. 25 years ago. I never used C++ much professionally, going first to Java, then Python, and then C. About two years ago I started doing more work in modern C++, and after the initial shock of “this isn’t the same language I learned years ago”, I’m constantly terrified at the growing complexity of C++. I’m glad to hear people with unbroken C++ experience admit that they don’t think anyone understands this thing well.
- synergy20 2y ago"the third option", what's the first two, pointers, then what? I'm re-entering c++, I wonder, can we just use a small subset of it and get the job done? it seems a core subset can get a lot done without all the complexities from c++
- synergy20 2y agosubset: 1. rule of zero 2. smart pointers 3. containers 4. simple class etc. Basically, something between c and c++, e.g. c+, that's more powerful and safer than C, but much less complex than the whole c++