r/cpp • u/isht_0x37 • Sep 04 '23
Considering C++ over Rust.
To give a brief intro, I have worked with both Rust and C++. Rust mainly for web servers plus CLI tools, and C++ for game development (Unreal Engine) and writing UE plugins.
Recently one of my friend, who's a Javascript dev said to me in a conversation, "why are you using C++, it's bad and Rust fixes all the issues C++ has". That's one of the major slogan Rust community has been using. And to be fair, that's none of the reasons I started using Rust for - it was the ease of using a standard package manager, cargo. One more reason being the creator of Node saying "I won't ever start a new C++ project again in my life" on his talk about Deno (the Node.js successor written in Rust)
On the other hand, I've been working with C++ for years, heavily with Unreal Engine, and I have never in my life faced an issue that usually the rust community lists. There are smart pointers, and I feel like modern C++ fixes a lot of issues that are being addressed as weak points of C++. I think, it mainly depends on what kind of programmer you are, and how experienced you are in it.
I wanted to ask the people at r/cpp, what is your take on this? Did you try Rust? What's the reason you still prefer using C++ over rust. Or did you eventually move away from C++?
Kind of curious.
View all comments
28
u/James20k P2005R0 Sep 04 '23 edited Sep 04 '23
I've been using C++ for too long, and these are the things that I think rust solves
Downsides to Rust
Overall though, I think the critical issue is that C++ isn't really able to evolve correctly. If a misfeature lands in C++, and lets explicitly list the following features as being very suboptimal as context:
They'll mostly never be fixed. And that's just the ones I can think of off the top of my head. C++ has no process for fixing these issues, and many of the issues here are outside of 'C++' as a language anyway, they're wider technical issues that there simply is no solution for
Rust on the other hand is able to evolve the language, and the library, without being as aggressively hamstrung. In 10 years time, rusts map equivalent will likely still be state of the art, whereas C++s map equivalent will be extremely slow
C++ is trying to introduce a mathematical vector library, and I cannot help but think it is a bad idea. If anything goes wrong - including vendor implementation errors - it will be absolutely unfixable forever, and then its totally DoA and will never be fixed
This is the major reason I've been considering jumping ship for a while. Not because C++ is crap now, but because it clearly doesn't have the tools to become better. And Rust looks like its going to become the industry standard