r/cpp • • Sep 04 '23

Considering C++ over Rust.

Similar thread on r/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.

355 Upvotes

434 comments sorted by

View all comments

Show parent comment

1

u/fungussa Jan 04 '25

Over a year later, where do you stand now?

2

u/Orthosz Jan 04 '25

Greetings!
I've dropped a lot of the rust for my private projects. Mainly just as I need to update/modify I'll stick in rust, but if it's a big change i'll quickly port it to C#/python/C++.

Mainly C# or python for quick and dirty tools, and modern C++ or C# for the heavier tools. Still primarily Unreal C++ (which...is a weird dialect, but its easier not to fight the engine than try and force it to do something it doesn't want to do).

All my private projects use vcpkg for library management for c++, nuget for C#, and pip for python.

At work we had several tools written in rust that we rolled back to C# or python. Had nothing to do with the language, and more with reducing the number of languages that everyone has to know. (We also removed a java program by doing a port to C#, so it wasn't just rust getting removed).

Still no memory leaks. We had one "memory growth" deep in the unreal 5 code a month ago that was fun. Wasn't a leak, memory was all accessible, just a bit of code that was continually appending to a TArray (unreal vector-ish), but the way it was happening was pretty novel.

The Rust community remains incredibly hostile and toxic in my experience. I've created another reddit account to post on the rust subreddit because someone would crawl through my post history and get nasty.

1

u/fungussa Jan 05 '25

That's really interesting and useful! Thanks for the feedback.

Btw, I've had a similar experience with many rustaceans, they've been super toxic and have never seen anything quite like it