Re:Matt Godbolt sold me on Rust by showing me C++
by bigbuppo on Wednesday May 07, 2025 @12:20PM
(#43917609)
It's weird that this sort of debate around C++ often leaves out the fact that many of the problems with C++ were known before C++ even existed. Outside of a few specific buckets, there is no reason to use C++ for any new projects, and really, there never has been. If you can't stomach Rust for some reason, and I'm one of those people, there are plenty of choices out there without all the pitfalls of C++ or C.
[ Parent
| on HN ]
Re:Matt Godbolt sold me on Rust by showing me C++
by ivmaykov on Wednesday May 07, 2025 @01:07PM
(#43918203)
> If you can't stomach Rust for some reason, and I'm one of those people, there are plenty of choices out there without all the pitfalls of C++ or C.
Unless you are doing embedded programming ...
Re:Matt Godbolt sold me on Rust by showing me C++
by fsloth on Wednesday May 07, 2025 @01:38PM
(#43918549)
I think embedded is one of the specific buckets.
You target the compiler your client uses for their platform. There is very little choice there.
Re:Matt Godbolt sold me on Rust by showing me C++
by int_19h on Wednesday May 07, 2025 @10:00PM
(#43922404)
Even then you're probably better off using something safer that transpiles to C.
Re:Matt Godbolt sold me on Rust by showing me C++
by fsloth on Thursday May 08, 2025 @08:37AM
(#43925522)
”Transpiles to c” - how do you generally optimize single line performance hotspots in that case?
Re:Matt Godbolt sold me on Rust by showing me C++
by int_19h on Thursday May 08, 2025 @04:27PM
(#43930952)
I don't see why that would make any difference? The generated C code is just a build artifact in this case, similar to IRs often used by compilers internally. You don't think about e.g. gcc IR when you optimize hotspots in code written in C, though - you just look at the C source and the generated asm code. If you have, say, Zig transpiling to C (which it can do with `-ofmt=c`), you'd similarly look at the Zig source and the generated asm code.