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.
12
u/c_glib Sep 05 '23
Thing is, java and go have indeed taken away projects (indeed, entire fields of programming) from C++. I have been around long enough that C++ and things like MFC were the standard way of writing enterprise apps and C++ (or indeed, plain C) was the standard choice to write a high performance concurrent server (remember pthreads?). Java and Go have taken away a large chunk of that space from C++. And for some very good, practical reasons. Rust will take away some more. In the end, C++ will turn into a niche language for niche and legacy projects. Now, the legacy part is indeed massive and there will always be projects and jobs for the practitioners. So there's no need to panic. But it's definitely hard to make the case that the space for C++ has not shrunk because of competing ecosystems.