Live data from Hacker News

Ask HN: What is the state of C++ vs. Rust?

news.ycombinator.com

1–10 of 156 posts

Ask HN: What is the state of C++ vs. Rust?

#1
I would love to hear the thoughts of people who have kept up with the developments in both these languages.

Some of the stuff I'm wondering along is features, safety, performance, simplifying the language and so on.

C++11/14 brought good things to the table, perhaps C++17 will bring more improvements?

I havent gone through the proposals for upcoming features in either language but seems like the pace of Rust development is really good.

But then there is the idea of ignoring legacy C++ and treating Modern C++ as a new language altogether.

Just curious to hear anyone's thoughts on the state of these two languages.

Re: Ask HN: What is the state of C++ vs. Rust?

#2
Rust is promising but C++ is here to stay.

If you have a legacy C++ code base, it is much easier to sell that you are just upgrading the compiler to get new language features, that you are rewriting everything from scratch.

Now we'll have to see in the next few years if, for new projects, Rust is chosen over C++ wherever it was used traditionally and in which proportion.

Re: Ask HN: What is the state of C++ vs. Rust?

#3
This is all personal opinion so take it with a grain of salt.

I think Rust could do some serious C++ competition if it could dethrone C++ from some platform or have a worthy alternative.

That is I think Rust really needs a killer app/platform/problem similar to how Swift has Apple devices and DevOps now have Go.

If Rust could get into a gaming platform or have a really good gaming library like Unity it could have a good starting point to move over mind share.

Alternatively I think Rust could compete heavily with Go since the whole microservices space is still sort of up for grabs (or atleast is so massive that there is plenty of pie to be had).

Rust's current niche (ie users) is language aficionados which historically hasn't been a good niche (ie Haskell) for language propagation. That is I think Rust could get more popular if it can get heavily used by a set of niche users at first.

Besides mircoservices and games an interesting niche might be Arduino and IOT [1]. That might be a good niche/platform to dethrone C++.

[1]: http://jakegoulding.com/blog/2016/01/02/rust-on-an-arduino-u...

Re: Ask HN: What is the state of C++ vs. Rust?

#4
I have a large existing C++ codebase but haven't worked in Rust yet. But from what I've seen, Rust looks like a very well designed language that has the low-level and performance aspects of C++, with similar flexibility. IMO the killer feature is the borrowing mechanism which provides provably-safe memory access, eliminating whole classes of memory/security bugs, with minimal performance impact. I don't think C++ will ever expand to encompass that. I haven't got much experience with the Rust toolchain but I think that's a strong reason to seriously consider Rust for any new projects.

Re: Ask HN: What is the state of C++ vs. Rust?

#5
I have a big C++ legacy code, and it gives me a lot of headhaches. I'm using Rust in some small projects and it's great, no problens with null pointers :). I think a great feature of Rust is that it is easy to use inside C/C++ projects, so u can upgrade your current legacy code without rewrite it :)

Re: Ask HN: What is the state of C++ vs. Rust?

#6
post #3

This is all personal opinion so take it with a grain of salt. I think Rust could do some serious C++ competition if it could dethrone C++ from some platform or have a worthy alternative. That is I think Rust really needs a killer app/platform/problem similar to how Swift has Apple devices and DevOps now have Go. If Rust could get into a gaming platform or have a really good gaming library like Unity it could have a g…

For those not aware of it, Tokio https://github.com/tokio-rs/tokio is a platform that is being built on top of Rust Futures for building exactly these types of services.

It's built around futures and mio, so Tokio services are async, and elegant.

Re: Ask HN: What is the state of C++ vs. Rust?

#7
post #5

I have a big C++ legacy code, and it gives me a lot of headhaches. I'm using Rust in some small projects and it's great, no problens with null pointers :). I think a great feature of Rust is that it is easy to use inside C/C++ projects, so u can upgrade your current legacy code without rewrite it :)

Do you mean C/C++ and Rust interop? Maybe link them together to form the final executable binary? Can you share more experience on how do you do that?

Re: Ask HN: What is the state of C++ vs. Rust?

#8
post #2

Rust is promising but C++ is here to stay. If you have a legacy C++ code base, it is much easier to sell that you are just upgrading the compiler to get new language features, that you are rewriting everything from scratch. Now we'll have to see in the next few years if, for new projects, Rust is chosen over C++ wherever it was used traditionally and in which proportion.

Like all legacy code, it will not be replaced. Now if people wanted to bifurcate their codebase they can easily add Rust libraries to existing C++ codebases.

In my experience I find Rust to be more productive than C++ and easier to write. Obviously that's a pure opinion.

Re: Ask HN: What is the state of C++ vs. Rust?

#10
post #7
post #5

I have a big C++ legacy code, and it gives me a lot of headhaches. I'm using Rust in some small projects and it's great, no problens with null pointers :). I think a great feature of Rust is that it is easy to use inside C/C++ projects, so u can upgrade your current legacy code without rewrite it :)

Do you mean C/C++ and Rust interop? Maybe link them together to form the final executable binary? Can you share more experience on how do you do that?

Rust produces standard linkable system libraries. You can produce dynamic libraries or static libraries on all supported platforms.

For actual examples of using Rust with other languages through these libraries this site is great: http://jakegoulding.com/rust-ffi-omnibus/

Post reply on HN