Live data from Hacker News

Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

news.ycombinator.com

81–90 of 92 posts

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#81

Earlier quoted context omitted.

> standards committee or bjarnes, what they're going to tell you is to rewrite it The same will be true for Rust in 50 years (assuming Rust doesn't die any time soon). If they didn't think it was worth modernizing, they'd just leave C++ alone (which I think they should, but that's another matter). For old C++, you run valgrind and a linter on it and if nothing comes up it's also "probably fine". At least it's hard fo…

> If they didn't think it was worth modernizing, they'd just leave C++ alone (which I think they should, but that's another matter). What about C? That's being modernized too, sometimes with novelties from C++ modernization, like `nullptr`! :p https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm

The amount of new syntax and programming concepts being constantly crammed into C is much smaller. If I had to quantity it, I'd estimate that C++ is by now roughly 3.5 programming languages in one while C is maybe 1.5...

The more stuff you have the more problematic (adding foot guns and making it hard to learn a language) it is to add more stuff because it all interacts. And a lot of C++ features interact in bad ways...

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#82
IMO one of the biggest downsides to Rust people don’t talk about as much is that there are a lot of abandoned and incomplete crates. The same is of course true in C++ but there is a very mature ecosystem there as others have pointed out.

The second thing I’d point out is that while Rust’s build tooling is obviously very nice for some cases, it’s not a silver bullet and C++ build _is_ a solved problem. It just can be a bit more of a lift to get rolling and add new dependencies, but these are infrequent costs. Adding a Rust component to a non-Rust build chain can be very painful, however. Cargo really wants everything to live in Cargo.

Last but not least, C++ also has extremely mature and comprehensive static and dynamic analysis tooling. It may be that Rust has begun catching up here, I’m not certain.

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#83

I am a retiring engineer/entrepreneur. I made a lot of money with C++. It is hard for me to tell anyone not to use it. I recently developed an oil and gas derivative tool in Rust. IMO Rust has a long way to go. It reminds me of OCaml. I spent 2 years developing a Compliance System on DEC/OSF1 in OCaml. We made the mistake of adopting that language too early. Also, the C++ community is a lot more tolerant. A big plus…

> I made a lot of money with C++.

Please elaborate.

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#84
post #28

Earlier quoted context omitted.

> Rust is just as capable at integrating with the specific platforms you're talking about. Maybe it’s possible but definitely not as straightforward to use rust on iOS. Compared to C++.

I have not personally used C++ or Rust in this context, so I can’t speak to the ease of either, so could you say more? The use-cases I know of basically build a library exposing the C ABI, which is slightly annoying but effective. I'm guessing you're referring to Swift C++ interop?

What I mean is that adding C++ files to your iOS project and having them compile and work together without any new compilation steps or settings, and to have Swift code call a C api on your C++ implementation -- all of this is straightforward to do for iOS, and Xcode even creates the "bridging" headers for you and has built-in support for C++. Now, adding Rust into the mix? That will be much more involved and certainly not as simple; nor is it natively supported by the iOS toolset in Xcode. That's what I meant when pushing back on your notion that "Rust is just as capable at integrating with the specific platforms you're talking about."

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#85
post #84

Earlier quoted context omitted.

I have not personally used C++ or Rust in this context, so I can’t speak to the ease of either, so could you say more? The use-cases I know of basically build a library exposing the C ABI, which is slightly annoying but effective. I'm guessing you're referring to Swift C++ interop?

What I mean is that adding C++ files to your iOS project and having them compile and work together without any new compilation steps or settings, and to have Swift code call a C api on your C++ implementation -- all of this is straightforward to do for iOS, and Xcode even creates the "bridging" headers for you and has built-in support for C++. Now, adding Rust into the mix? That will be much more involved and certain…

Thanks!

I wasn't trying to claim that they're equivalently easy: just that they both have the same capabilities, there's nothing special that one can do that the other cannot.

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#86

I am a retiring engineer/entrepreneur. I made a lot of money with C++. It is hard for me to tell anyone not to use it. I recently developed an oil and gas derivative tool in Rust. IMO Rust has a long way to go. It reminds me of OCaml. I spent 2 years developing a Compliance System on DEC/OSF1 in OCaml. We made the mistake of adopting that language too early. Also, the C++ community is a lot more tolerant. A big plus…

[dead]

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#88
post #62

Earlier quoted context omitted.

In which ways does Rust need to improve, in your opinion?

I'm fond of rust, but compared to go, I dislike that you need a different code path to support sync vs async in a module. Or pick a different runtime like Tokio. So you end up with modules that are async only, sync only, or both. Makes me miss go, which has channels build in, has a runtime built in, and both are generally solid. None of use flavor A for this, use flavor B for that, or write wrappers for the wrong col…

Rust has channels built in. In fact, the std channels were recently rebuilt on top of the excellent crossbeam crate.

Function colors is kind of a meme but maybe-async functions are coming.

https://lib.rs/tokio is king for std environments, https://lib.rs/embassy for no_std.

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#89
post #62

Earlier quoted context omitted.

I'm fond of rust, but compared to go, I dislike that you need a different code path to support sync vs async in a module. Or pick a different runtime like Tokio. So you end up with modules that are async only, sync only, or both. Makes me miss go, which has channels build in, has a runtime built in, and both are generally solid. None of use flavor A for this, use flavor B for that, or write wrappers for the wrong col…

Rust has channels built in. In fact, the std channels were recently rebuilt on top of the excellent crossbeam crate. Function colors is kind of a meme but maybe-async functions are coming. https://lib.rs/tokio is king for std environments, https://lib.rs/embassy for no_std.

Yes, MPSC, single consumer which is limiting.

Re: Ask HN: Are there any good reasons to use C++ over Rust for new projects today?

#90
C++ has DECADES of content to use. even if you filter everything that's outdated, the sheer quantity of libraries made in c or c++ first and then having either rust bindings or a third party conversion to rust as a hobby project is orders of magnitude bigger than the ammount of libraries and frameworks made with and for rust.

Older c++ programs also had the "perk" of compiling and running even when there was some memory leak or other problem and, in production, many times the deadline is so strict that a developer has to ship something bugged and just add a note somewhere saying "if you use function X, it will freeze or crash". the Rust Compiler won't let you ship a program without fixing the problem first

Post reply on HN