Re-read through Mike Acton's "Typical C++ Bullshit" last night, and noticed a weird comment near the end:
"References? Useless cruft"
So... what's the problem with c++ references? Is it just that you don't get to control when the pointer deref happens?
@bobvodka huh, never thought about references that way, that's really interesting. I'm going to ask @ work today how people interpret a function signature with references.
We always use them to communicate that an arg can't be null, but I wonder if people also expect it to communicate single vs array.
@norado it's a problem, but c++ has so many problems that I think people just gloss over this one. It would be nice to see a language addition for something like the ref keyword in c# to make the callsite explicit about reference vs copy
I think 'useless cruft' does not mean there is anything _wrong_ with them, but that (some think) they add nothing of value. I tend to agree. I don't think whatever small benefit they may add outweigh the problem of having two ways of passing something indirectly.
@Istarnion It's interesting to hear all the negative sentiment around references! The code bases I've worked on have used them extensively as a way to communicate that "you shall not pass null to this argument," and no one has batted an eye.
Game development! Discussions about game development and related fields, and/or by game developers and related professions.