Live data from Hacker News

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

news.ycombinator.com

1–10 of 92 posts

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

#1
Hello! My go-to language to develop something that needs high performance has been C++. I do a lot of high frequency transactions, systems programming (implement tiny compilers/interpreters for domain specific problems and such), personal projects, etc. and I usually start my projects in C++. But it is increasingly looking like Rust can solve all the problems that C++ can without losing performance and while gaining better memory safety guarantees and better type invariance guarantees. The packaging story, Cargo, etc. of Rust are definitely very attractive!

So that brings me to the question. Is there any point in starting new projects in C++ anymore?

I don’t want this to turn into a language flame-war. My question is in good faith and I do want to learn from the wisdom of the folks who comment here. People who have been using Rust for much longer than I have can offer valuable insights that I might not know. So to avoid flame-wars, let me make this question as specific as possible:

1. Is there any context in which it makes more sense to start a new project in C++ instead of Rust?

2. For someone like me who is not too experienced in Rust, what are the things I should watch out for or be careful about when starting a new project in Rust?

3. Any other free-form advice you have for someone like me who is considering making Rust my go-to language for doing new projects?

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

#3
If you need to interact with existing C++ code or libraries obviously C++ is going to be a much easier path than using Rust. If you don't have such a requirement, or you think that the available Rust libraries are good enough for what you're doing, then use whatever you want.

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

#7
Consider cross-platform -ness. For example, if you make a new app with domain logic in C++, you can build it on iOS through Swift/Objective-C++ >> C++, or on Android through Java JNI >> C++, or on React Native through JavaScript Interface (JSI) >> C++, or on Linux through wxWidgets >> C++, or... etc.

Other than that, Rust is a great language with a great compiler eliminating whole categories of bugs possible with C++.

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

#10
I used to have parallel feelings about Scala as a newer better alternative to Java. Then I ran into some issues with it in the real world. See if there are any parallel, I will copy-paste the issues I reported before:

"There were some problems with Scala in the real world. Compared to Java it had a big learning curve, what with all the features it took from Haskell and functional programming while also keeping all the old features of Java. Some of the libraries weren't as mature as their Java equivalents or there were two equal competing libraries whereas with Java there was just one popular library for a given thing. Hiring Scala developers was an issue. Compile times were bad. Every major version of Scala (ex. 2.10, 2.11, 2.12, etc.) broke backwards compatibility so if you had something with say Scala macros that compiled in Scala 2.10 it wouldn't necessarily compile in Scala 2.11 without code changes. We had a library where the maintainer abandoned it at Scala 2.10 and we couldn't upgrade to Scala 2.11 without either taking the library out and using something else in its place or taking over the library, which just wasn't feasible. There was an issue with Scala that I've seen with C++ as well where the language is so big that different teams and different people program in different "dialects" of the language, using different subsets of language features (ex. some people used OOP class inheritance and some did not). Lots of people didn't get Monads or functional programming. But yeah, lots of places ended up going back to Java or using Node.js if they wanted to be async/reactive. "

Post reply on HN