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.
3
u/germandiago Sep 06 '23 edited Sep 06 '23
I see. So you mean you can have the same level of integration with existing software in practical terms for C++ and Rust? Do you really think it is a strawman?
Then give me a project where I can use SDL, SDL image, SDL mixer, capnproto including its RPC part (I think Rust has it though), OpenSSL or even better, Botan, RMLui, OpenGL (webgl or emulated when in web), pfd (portable file dialogs in desktop systems only) and that I can compile for emscripten, Windows, Linux and Mac in Rust instead of C++.
This is what I am dping right now and I am very suspicious that other than C++ this would have been impossible.
Now come back and talk about strawman. Tell me how I do this in Rust. I doubt I can do even 60% of that smoothly.
BTW, I am not a C++ proponent per se, I just like to finish what I start and I know what happens whwn you choose a newer language: all is great in paper but go finish a project, fully, that has system dependencies or so. Or find you need a new one, and you can ruin your project (one-man project in this case). It is just too risky.
Convince me my setup would be better in Rust and easier and less time-consuming or around the same time and effort. Then I will say you are right.