| Learn both. If you learn C++ first, and then learn Rust, you'll find that Rust is sort of a pleasant syntactic cleanup over modern C++ idioms. You'll be happy with the high-quality standard library, mechanically-enforced best practices around nullptr/const, and a core language team that is actively engaged with driving forward progress. If you learn Rust first, and then learn C++, you'll be amazed by the wealth of libraries that are available. There are still entire ecosystems (looking at gRPC and Protobuf here...) that are C/C++ first, with bindings to other languages, and basically no first-party support for Rust. There's a lot of benefit to being able to reuse existing work. And once you've learned both, and gotten a handle on the FFI syntax, it becomes natural to write greenfield code in Rust while being able to "drop down" into C/C++ when necessary. The number one rule here is you must focus on modern C++, not old-school stuff with void* pointers and reinterpret_cast<> everywhere. It's easy to learn low-level programming the wrong way, which will cause your C++ code to be low-quality and frustrate your learning of Rust because you'll constantly be colliding with the guardrails. |
I've seen this sentiment expressed frequently and while I understand this sentiment, I'm curious how in a practical sense one goes about learning "Modern C++" while avoiding "old-school stuff." Don't many codebases contain "old school stuff"? I'm trying to get my head around how I would know something is the old school way that should be replaced with an idiomatic Modern C++ equivalent without knowing what the old school thing is in the first place.