Hacker News new | ask | show | jobs
by IshKebab 39 days ago
You want to use Qt. Or you're writing for a platform where you have no choice (most microcontrollers for example).

From a language perspective the only one I can think of is that C++ coroutines are much more powerful than what Rust gives you at the moment, even though they are very footgun-dense (quelle surprise).

But yeah, overall there is very little reason to pick C++, especially now it's feasible to translate existing C++ to other languages.

3 comments

> Or you're writing for a platform where you have no choice (most microcontrollers for example).

I don't get this in particular. All of these devices have C, which seems like a better fit for the problems you'd likely have on a platform that's small or obscure enough that it hasn't got something nicer than C++

In places where you can use C you can just ask easily use C++. It has a number of nice ergonomic improvements that make it a better option than C, though you would typically opt out of exceptions, RTTI, and maybe the standard library.
You can, but I don't think you should. I can see how the ergonomics are appealing for larger software but the value seems very slim on a microcontroller. Of course I'm biased, but I actually think more of this software ought to be in assembler - whereas perhaps you'd expect I believe it should be Rust.

I think when 20% of your code is trying to energize a solenoid or wrangle a temperature sensor and another 20% is trying to make the vendor's awful LCD controller do something useful and not insane you'd be just as happy writing the mnemonics for machine code instructions and you'd spend less time staring at diagnostics trying to guess why it's doing whatever it's doing because your ten year old fork of GCC has a bug.

> I actually think more of this software ought to be in assembler - whereas perhaps you'd expect I believe it should be Rust.

Yes obviously. Or potentially Zig once it is more stable.

Doing it in assembly in 2026 is absurd.

For most microcontrollers you'd want to use today (ARM and RISC-V mostly, Xtensa or AVR if you like pain) you can just use Rust.

For anything weirder than that (PIC?) where Rust is no option, it's not like you have no choice either: You can just pick C.

> You want to use Qt

But isn't using Qt like learning a whole new layer of language on top of C++, the meta compiler, signal/slot system etc and then Qt have its own set of standard classes like QString (instead of using std::string)

Sure, but Qt (at least QtWidgets) is still really good, even if it is aging quite badly at this point.

The signal/slot system actually doesn't need MOC anymore, and the custom container classes are pretty obvious.

That said I think some Rust GUI frameworks are finally starting to mature. I quite like gpui-kit (formerly gpui-component). Maybe not as easy to use as Qt but it doesn't matter so much now with AI.

C++32’s std::ui will solve that.
And then C++38's std::ui2 will solve that.