At the end of it you might even develop Stockholm syndrome and be one of those posting “if you just restrict yourself to these parts of the standard and run this 6 static analysers on your code then c++ is perfectly safe if you’re not an idiot”.
If you don’t want to learn c++ for its own sake, that’s time you could better spend learning a language that’s not actively trying to harm you.
Source: coded c++ for 20 years, now writing rust as much as possible.
For the work I do GC is also a non-starter. I know it’s got some level of no-gc now but the last time I looked it wasn’t well-supported.
In short it seemed interesting but on-boarding felt hard. And with that the value proposition wasn’t there or well-advertised: It’s supposedly “better” in some ways such as faster compile times and better meta-programming and frankly that didn’t seem worth the effort.
Rust by contrast does an excellent job of onboarding and making it easy to learn the language (at least at an introductory level). It also comes with a very straightforward value proposition: just as fast as c++ but whole classes of bugs simply aren’t possible. Add in a little bit of ergonomics and functional flavour and I was hooked.
What I liked on it over Java and .NET languages, is no longer relevant after GraalVM, and the low level features in C# 7/8 adopted from Midori, came to be.
Also C++20 now makes much D less relevant.
Unfortunately the recent @safe and @live discussions don't inspire confidence in which direction they want to drive the language design.
With enough time, you will realize that any language try to harm you and has quirks. Just different quirks in different scope. Rust included.
> Source: coded c++ for 20 years, now writing rust as much as possible.
I coded for C++ for a smilar time. Now I write Rust on my free time and I still enjoy C++.
This "nightmarish many-tentacled footgun monster" is still a pleasure to use for many use cases and far more powerful than Rust for some scenarios ( constexpr/consteval, template with const litteral, overloading, low level control on memory allocator and a gigantic ecosystem of high quality libraries)
1. The learning materials are much better. The official Rust book is excellent. And it doesn't take long to do a first run through it.
2. You'll learn much quicker with Rust. With C++ it could take you years of experience to gain a full appreciation of the pitfalls because they're often not apparent when you first write the code, only when you actually run into the bug further down the line. With Rust, you'll get a compile error and enlightenment is quick google and a reading of a blog post away.
3. Some parts of Rust only seems to be difficult for C/C++ programmers who have learnt the C(++) way of doing things and expect that to translate into Rust. They get frustrated when Rust doesn't let you use certain patterns. However as C++ is generally less strict, if you learn the Rust way first, then you'll generally be able to translate that fairly directly into C++.
I also think 2 and 3 are ... overstated.
I’m not sure which is correct.
If I weren't a C++ programmer first, I don't know that I would really grok the value proposition of Rust (not dealing with Move Constructors) or the trade-offs (library code has to provide differently-named functions that trash resources as an optimization, rather than just providing an overload that eats temporaries).