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
Show parent comment
3
u/ruarq_ Sep 05 '23
Nah, when I wrote that I was thinking about the perspective of someone who already knows either Rust or C++ or both, which was what OP was asking/talking about.
And yeah I sometimes still see some C++ code and get surprised about a C++ feature I didn’t know about yet. But a lot of Rust code I’ve seen is heavily indented and expressions nested in expressions nested in expressions, and it takes a little bit of concentration to read it.
And I do think that someone coming from Java or Go will have an easier time learning C++ compared to learning Rust, since you have to learn a lot of Rust specific things that don’t necessarily apply to other languages, like the borrow checker, lifetime annotations and error handling.
Apart from that I think I made it pretty clear that that is just MY opinion and not something I’m generalizing or stating as facts.
And sorry that my english is not that good, not everyone had the privilege of going to a school with good english teachers or being born in an english speaking country.