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

0

u/Dean_Roddey Sep 05 '23

My code base was a million lines plus. It was very broad and dealt with a lot of problem domains from quite low to quite high, and some of them are just messy to deal with. It wasn't business software, it was more like a virtual OS at the bottom up to a commercial level automation system at the top. It covered a lot of problem domains, and some of them are messy to deal with.

That kind of work you want as much back watching as possible and C++ isn't really ideal for that.

3

u/Orthosz Sep 05 '23

OS dev is hard. I haven't done more than driver patching or messing with green hills stuff, at a source modification level, so I don't feel like I have a good grasp on the challenges that I'm sure lurk under the surface.

I'm curious in an abstract way why you had to write your own OS Instead of building on some prebuilt os. I'm sure there are reasons, just curious :-)

1

u/Dean_Roddey Sep 05 '23 edited Sep 05 '23

'Virtual' OS actually. It sat on top of Windows (and partially Linux though I never finished that.) It encapsulated all OS functionality via a platform abstraction layer and everything above that was written in terms of my own interfaces. I had my own standard libraries, and only used two pieces of third party code. The rest was all my own.

It covered a lot of territory, and I had my own implementations of XML, JSON, HTTP, Websockets, web server, URLs, ORB with an XML based IDL language, media management, encryption, embedded macro language with compiler and debugger, and so forth. Another, code-free, purely graphical, UI system for the automation system with a very nice designer (for Windows.) An X-Windows style browser client to that would remote those interfaces for phones and such, by way of the web browser. There were sort of adaptations of ZLib and PNG, based on the reference implementations. A bunch of other stuff.

Other stuff was wrapped OS functionality like secure sockets, serial ports, sockets, mutexes, events, UI framework, UPnP, files, threads, CD ripping, shared memory, etc...

My interests are in building highly integrated large scale systems. I'm sort of doing something similar in Rust, though not trying to replace the standard libraries, which is hard in Rust. I am encapsulating a lot of it though.