Live data from Hacker News

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

news.ycombinator.com

61–70 of 92 posts

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

#61
post #51

Every language has its own merits, there's no single language that's universally the best for every task. With that said, C++ and Rust both occupy similar domains (high-performance, low-level, often interacts with OS syscalls or hardware). Pros of C++: - More mature, excellent library ecosystem, decades of code to reference from. - Syntax is arguably easier to read and write - It's very popular (top 6th language on G…

I usually hear about people using Rust with C. You use Rust and C++. If you use them together, how easy is it to call Rust from C++ and vice versa? And can you do that with their standard interfaces instead of watering it down to the lowest, common denominator?

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

#62

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…

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 color function.

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

#63

I've heard from some of my colleagues at other companies that Rust has a significant negative impact on developer productivity compared to C++. This makes Rust great for, say, the Linux kernel, where the security and performance features are really needed and the maintainers don't give a rat's ass about how much time and effort it takes for contributors to get their features merged. On the other hand my current compa…

My personal experience and that of many people I've spoken or listened to is the opposite. Mozilla and Oxide engineers talk about how much easier refactors are and how much less time is spent mucking around with build systems in Rust.

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

#64

I've heard from some of my colleagues at other companies that Rust has a significant negative impact on developer productivity compared to C++. This makes Rust great for, say, the Linux kernel, where the security and performance features are really needed and the maintainers don't give a rat's ass about how much time and effort it takes for contributors to get their features merged. On the other hand my current compa…

personal antidote - i've heard this too, but jumping in (after years of python/typescript), i'm blown away by how productive i can be. it's easily my favorite language.

the hiring pool may be smaller, but don't believe the fear.

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

#65
post #51

Every language has its own merits, there's no single language that's universally the best for every task. With that said, C++ and Rust both occupy similar domains (high-performance, low-level, often interacts with OS syscalls or hardware). Pros of C++: - More mature, excellent library ecosystem, decades of code to reference from. - Syntax is arguably easier to read and write - It's very popular (top 6th language on G…

>- Syntax is arguably easier to read and write

This generally comes down more to familiarity than "ease". C/C++ are familiar.

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

#66

One I don't see mentioned here is market. There are far more c++ developers out there. Whether you're writing a library that someone else will be using, or you want to hire people (or have people contribute), c++ is a much larger "market". This doesn't mean I'm necessarily advocating for c++ or rust, but c++ definitely has advantages over rust, even if they're not just intrinsic.

Rust has good FFI with C++ meaning that you can write Rust libraries that are consumed by C++ programs. C++ developers understand all of the concepts needed to easily pick up Rust. As long as it's not a quick project that will be immediately thrown away getting C++ to use Rust will be worth it.

Rust has good FFI with C, and do does C++. The Rust C++ FFI experience is still a bit rough.

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

#67

I'm "Rust curious", but I'm coming from a web/app background (Dart, JS, TS, Java, Python), so take my ideas with a grain of salt. 1. One context, which appears to be yours, is when a team or individual has extensive C++ experience. You see, for me, learning C++ with all its decades of good/bad parts feels overwhelming, so Rust makes sense for me even if it's still the hardest language I've ever learned, but as you ar…

Here is my advice on learning C++. Don't learn it first. Learn C first, become good at it. Then ease your way into using certain functionality of C++ in your code, and so on. Don't try to bite it all off at once. I've been developing in C++ for over 30 years now, and I'm still learning something new about it.

Look at it like Mathematics. You learn Algebra, and Trig, but Calculus is a something different. If you don't have a solid understanding of the previous, you're not going to understand the symbolic manipulation of Calculus. It then gets worse from there as you go into Differential Equations.

IMO procedural and imperative programming should be understood before trying to grasp polymorphic, object-oriented and functional programming. There is a lot of abstraction, and training of your mind to abstract is a process.

Be careful, there are purists that exist out there, and they will scream and complain, but ignore them. Don't let others control how you think. A late professor of mine once told me something I thought I understood, but it didn't hit me until years later.

"Any program written in any language that produces the correct results is a correct program."

As long as it does what it is supposed to do, it doesn't matter how you get there.

Also, code purity is myth, and those seeking it are believers in mysticism and false aesthetics. There is good code organization, but when you're up against deadlines, good luck keeping it organized.

This memory safety issue is important, don't get me wrong, but it is completely over blown. SpaceX built incredible rockets and systems in C/C++. We have external tools to check for these issues, and they still need to be used with Rust.

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

#68
Some arguments in favor of C++:

1. Much faster compilation speed.

2. Having to syntactically specify ownership is annoying and a waste of time in many cases. Unless you need the hand-holding, but then low-level programming isn't for you. :P

3. Multiple compilers. Ironing out bugs is easier when you have both clang, gcc, and msvc.

4. Valgrind and other tools for debugging, profiling, and analysis.

5. Personally, I find Rust's syntax obnoxious and cluttered. With C++, most of the clutter can be avoided which I like.

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

#69

I've heard from some of my colleagues at other companies that Rust has a significant negative impact on developer productivity compared to C++. This makes Rust great for, say, the Linux kernel, where the security and performance features are really needed and the maintainers don't give a rat's ass about how much time and effort it takes for contributors to get their features merged. On the other hand my current compa…

I can't confirm that. Rust's safety features allow moving fast without fear of subtle bugs.

Developing in Rust can feel like fighting the compiler though when choosing approaches / architecture that aren't a good fit for Rust. This happens a lot when people only have little Rust experience. For example: Writing a linked list can be quite challenging in Rust due to self-referential types. With more experience in Rust, developer learn how to best structure the code so that it doesn't result in this friction.

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

#70

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 recently developed an oil and gas derivative tool in Rust

Sounds cool! Could you elaborate? Would you have a website somewhere? Do you have any contacts details?

Cheers!

Post reply on HN