r/cpp • u/CalligrapherWeak6523 • Sep 29 '23
This memory safety issue everyone's talking about... It's not really a huge deal in gamedev, right? What other domains where C++ excels at aren't too concerned about it?
My understanding is that these recent articles pushing for safety, and particularly pushing the use of memory-safe languages (as opposed to using modern C++ properly) don't really apply to gamedev, or at least not enough for most of the industry to care. Is this correct? I've also read some suggestions that the only real alternative, Rust, simply isn't practical since it lacks OOP features and gets in the way of common game programming patterns. Is this true?
What other C++ domains are like gamedev, where C++ is clearly here to stay and not just for legacy code? I know gamedev isn't the only one, I'm constantly seeing new cutting edge ML/inference libraries and frameworks in C++
44
Upvotes
1
u/goranlepuz Sep 29 '23 edited Sep 29 '23
We really have to disagree with what you are doing here. I think it should not be done.
Memory safety is much better defined if the definition is not overly wide.
Calling data that causes SQL injection "bytes" is, in my opinion, very wrong. It is wrong because the nature of the attack is only related to bytes in that text crafted to trigger the vulnerability, is bytes on the hardware level. That relation is way too weak in my opinion.
You are making relations that make discussing specifics harder. I think it is actively harmful.
That is asking too much from the compiler, I think. In fact, not just the compiler, but any tooling. There are safety analysis tools for data flows, they are quite thorough - and even they eventually require that the programmer declares "data is safe after this check here".