Live data from Hacker News

I think C++ is still a desirable coding platform compared to Rust

lucisqr.substack.com

101–110 of 110 posts

Re: I think C++ is still a desirable coding platform compared to Rust

#102

Earlier quoted context omitted.

I actually think Cargo & crates.io are the weakest and shittiest part of Rust right now. They're a bit amateur. But yes, CMake is something I do not miss. Though I miss the alternatives even less. Though C++ with Bazel is actually quite attractive.

So having one easy to use build system (and actual package manager) is worse than having countless arcane build systems?

In practice, there are only like, three-ish build systems in C++, and they all work better than cargo. There are a handful of issues cargo could get around to fixing that would help dramatically, but they always seem like they would rather spend hours arguing in the comments to bikeshed a patch rather than deign to type even a single line of code themselves, so they burn out all of their contributors and end up with critical fixes stalled for literal years while projects pile on ridiculous workarounds that no one ever documents anywhere :/.

Re: I think C++ is still a desirable coding platform compared to Rust

#103

Earlier quoted context omitted.

there is another key difference between rust and c++, rust by default bundles its stdlib into the executable, which make each executable kind of a static binary, they add up fast. c++ uses shared libraries, smaller in size for the whole system, and, you can upgrade a library separately too. on embedded systems where storage space is restricted, rust is simply a no-go.

All embedded applications and libraries can be declared with no_std, removing the std dependency and heap allocation. Shared libraries are also possible.

well without stdlib, there is not much I can do on non-mcu devices it's like I have c++ but no libstdc++ for a smart tv device development

Re: I think C++ is still a desirable coding platform compared to Rust

#104

Earlier quoted context omitted.

glibc can be shared by 20 c executables. rust stdlib will be bundled with those 20 rust executables, they blow up quickly. mcu does not use stdlib of rust, it uses no-std, c++ has its own nonstdlib as well, on mcu they're similar.

Yes, I understand what you're saying. I am saying that if you find yourself in that situation, don't use the Rust standard library. Your Rust programs can share glibc with your C programs just fine. This isn't a disqualifying situation for Rust. Heck, when you use the Rust standard library, dynamically linking to glibc is the norm!

maybe OP doen't know about #![no_std] !? You can not (as far as I know) have the Rust std lib as a dll, but you can chose to not use/include the std lib: https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/sh...

Re: I think C++ is still a desirable coding platform compared to Rust

#105

Earlier quoted context omitted.

Yes, I understand what you're saying. I am saying that if you find yourself in that situation, don't use the Rust standard library. Your Rust programs can share glibc with your C programs just fine. This isn't a disqualifying situation for Rust. Heck, when you use the Rust standard library, dynamically linking to glibc is the norm!

maybe OP doen't know about #![no_std] !? You can not (as far as I know) have the Rust std lib as a dll, but you can chose to not use/include the std lib: https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/sh...

Just FYI, these docs are very old. They’re for rust 1.25.0. Since rust is stable that means they’re still accurate, just not complete.

Re: I think C++ is still a desirable coding platform compared to Rust

#106

Earlier quoted context omitted.

Yes, I understand what you're saying. I am saying that if you find yourself in that situation, don't use the Rust standard library. Your Rust programs can share glibc with your C programs just fine. This isn't a disqualifying situation for Rust. Heck, when you use the Rust standard library, dynamically linking to glibc is the norm!

maybe OP doen't know about #![no_std] !? You can not (as far as I know) have the Rust std lib as a dll, but you can chose to not use/include the std lib: https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/sh...

of course I knew no_std, it's for MCUs, similar to c++'s nostdlib, I'm comparing rust's stdlib to libstdc++ though, but the former is not shared-lib friendly to say the least.

Re: I think C++ is still a desirable coding platform compared to Rust

#107

Yeah, that's a no from me. I'm a full time C++ dev and every time I code in Rust it is harder for me to switch back. The author has pointed to some issues regarding performance. In the end, you can always rewrite your code to generate other/better assembly, if you really need the speed. I would argue Rust is so much more that just Rust itself. Like many others after noted, it is not only the language, but the whole e…

Recovered c++ dev here. I started with rust in 2016 and never looked back!!

I started in my own time and even back then it was superior...

People like c++ for the language features... I dislike it because of all the defensive programming one must do....

Re: I think C++ is still a desirable coding platform compared to Rust

#108

Yeah, that's a no from me. I'm a full time C++ dev and every time I code in Rust it is harder for me to switch back. The author has pointed to some issues regarding performance. In the end, you can always rewrite your code to generate other/better assembly, if you really need the speed. I would argue Rust is so much more that just Rust itself. Like many others after noted, it is not only the language, but the whole e…

there is another key difference between rust and c++, rust by default bundles its stdlib into the executable, which make each executable kind of a static binary, they add up fast. c++ uses shared libraries, smaller in size for the whole system, and, you can upgrade a library separately too. on embedded systems where storage space is restricted, rust is simply a no-go.

You have the ability to remove the stdlib if needed...

Re: I think C++ is still a desirable coding platform compared to Rust

#109

There's a safe and sane language subset struggling to get out of "modern C++". The essence is following the Rule of 3/5/0, adopting value semantics, explicit ownership via unique_ptr/shared_ptr, resources wrapped as RAII objects. The syntax and feature space is certainly crowded and abused, but playing with the borrow-checker is an entirely different game.

Late to the party, but: this unfortunately doesn't seem to be true. There's no subset of C++ (or C for that matter) which is both safe and practical to use. This is why, say, the Chromium folks are seriously looking at adopting Rust. Same goes for the Linux kernel and their adoption of Rust, although of course that's a C codebase.

To rework an old comment of mine: [0]

There is no subset of C++ which is both safe and practical for real use. The MISRA C++ subset isn't enough to provide solid assurance of the absence of undefined behaviour, for instance. For that, you need a full-bore formal verification system, akin to that of the SPARK Ada language.

This is in sharp contrast to Rust, where there really is a subset which is safe 'by construction' (called Safe Rust).

[0] https://news.ycombinator.com/item?id=27605144

Re: I think C++ is still a desirable coding platform compared to Rust

#110
post #33

Earlier quoted context omitted.

In C++ discipline is optional. In Rust it's mandatory.

I think this is amusing because both directions completely work: In C++, you can do whatever. Rust forces you do to some things. No discipline required by C++, absolutely required by Rust. In C++, you can do whatever. Rust forces you to do some things. This means you must have discipline in C++, or you will do bad things. But in Rust, you can do whatever you want, the compiler has your back.

Good point, I was imprecise.

I should have said that no discipline is required in C++ to obtain a binary.

Post reply on HN