Live data from Hacker News

Ask HN: Why would you ever use C++ for a new project over Rust?

news.ycombinator.com

21–30 of 42 posts

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#21

Rust doesn’t even have a real GUI library yet, let alone support from common game libraries. C++ supports a hundred times as many compilation targets and platforms.

https://tauri.app seems to be fine.

I agree that the gaming industry is a place where starting a C++ project still makes sense.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#22
post #7

Earlier quoted context omitted.

Interesting, haven’t heard this viewpoint before of Rust being a drop in replacement for Java. From my limited experience with Rust it felt like the learning curve was way steeper than when I was learning Java for my previous job. Good point on C though, one of my old CS instructors would always call C his swiss army knife since its so small he had practically the entire syntax in his head.

OP never said rust was a drop in replacement for java

I think the notion of that comment is Rust is the new "new C++".

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#23
It boils down to a few key points:

Mature Libraries: C++ has a treasure trove of well-established libraries. For niche or legacy needs, C++ might be your only option. Performance Control: When you need to micro-manage performance, C++ gives you the nitty-gritty control that can make all the difference. Industry Norms: In some fields like game development, C++ isn't just preferred, it's expected. Sticking to industry norms can sometimes outweigh the benefits of newer tech. So, while Rust has its perks, especially around safety and concurrency, C++ still holds its ground where its deep-rooted ecosystem and granular performance control come into play.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#25
I've personally stumbled upon two - obscure hardware and GUIs.

It's really difficult to evaluate a hardware product with only a C(++) SDK using only Rust. There are of course ways around this but those are a significant amount of effort.

In terms of GUIs - there's simply no "Qt-Rust" that would work in a Rust-y way without causing massive headaches. Handling all that state is incredibly difficult in Rust, at least for me (but I recall others describing why as well).

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#26

The best way to think of Rust as essentially the new Java, which sort of "won" over C++ due to its more strict syntax with mandatory OOP and code patterns. Rust enhances this by running most of the checks in the compiler so you get native code, with very few runtime additions for type safety. But just like Java, its almost useless to code in it for personal or smaller projects. For almost all of my projects where I n…

> But just like Java, its almost useless to code in it for personal or smaller projects. That's entirely the opposite from my experience. Rust is a pleasure to code in for personal projects once you're familiar with the language, especially compared to C/C++. Managing dependencies is more straightforward, and there are a lot of crates out there to make writing your project easier.

You and I must have different ideas of "pleasure to code." The appeal of Computer Science for me is learning how things work at a deeper level, tracking every bit and byte, and pushing performance to its limits. The pleasure is in writing the interesting libraries, not gluing them together. Any technology that restricts me has zero appeal.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#27

Rust doesn’t even have a real GUI library yet, let alone support from common game libraries. C++ supports a hundred times as many compilation targets and platforms.

>> C++ supports a hundred times as many compilation targets and platforms. I would not want to be the one writing that CMakeLists.txt

If you are hardcoding anything platform related into your CML, you are doing that wrong. The default path must not be anything other than build and usage requirements. To support more usecases with CMake, you have to write less of it.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#28

If you want to create any real-time graphics application (video games, game engines, CAD software, visualization, etc.), or do any sort of scientific computing / HPC. The graphics ecosystem in Rust is still too undeveloped to see adoption (for the graphics API people are converging towards WebGPU, but it's still no match to Vulkan / DX12 / Metal), same goes for any GPGPU computing. Rust is also currently lacking in d…

There are BGFX crates for Rust, by the way.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#29

The best way to think of Rust as essentially the new Java, which sort of "won" over C++ due to its more strict syntax with mandatory OOP and code patterns. Rust enhances this by running most of the checks in the compiler so you get native code, with very few runtime additions for type safety. But just like Java, its almost useless to code in it for personal or smaller projects. For almost all of my projects where I n…

> But just like Java, its almost useless to code in it for personal or smaller projects.

I seem to be writing an OS with it just fine.

Re: Ask HN: Why would you ever use C++ for a new project over Rust?

#30

I've personally stumbled upon two - obscure hardware and GUIs. It's really difficult to evaluate a hardware product with only a C(++) SDK using only Rust. There are of course ways around this but those are a significant amount of effort. In terms of GUIs - there's simply no "Qt-Rust" that would work in a Rust-y way without causing massive headaches. Handling all that state is incredibly difficult in Rust, at least fo…

[deleted]
Post reply on HN