This question has been asked several times, showing that developers like yourself want to know whether Rust will replace the good old, painfully difficult to program, C++. Let’s find out, shall we?
Going with the trends
If I compare both Rust vs C++ on Google Trends, this is what I get. C++ beats Rust to death. Each one of C++’s troughs are like daggers piercing through Rust, pinning it down to the floor! C++ seems to have it’s own ups and downs, but it’s maintaining a pretty steady trend, over the past 5 years.
Now if I knock C++ out of the way, this is what I get,
That’s a pretty interesting trend there! I’d guess it’s about a 25 degree slope there. Never once has Rust seen a major dip in it’s gradual rise to fame. But what’s making it grow that well?
What Developers Love and Why
Okay, if you’re in a mood for funsies, try this out at your workplace: Assemble your team members in a room and then tell them there’s a huge project coming up. Tell them that the requirements state that it’s to be developed in Rust. You might find 78.9% of them beaming! Give it a few moments, then say you’re sorry and that you actually meant C++. Watch those smiles go right out the window! 😉
You might wonder why I used the very odd percentage, 78.9%. Well, that’s just the percentage of developers who love Rust, as per the 2018 StackOverflow survey. Now this isn’t something that happened overnight, as Rust topped the charts even in 2017, with 73.1% respondents loving the language.
You want me to talk about C++ too? Okay, if you insist, where is it? Ahhhhh… there it is!!! C++ coming up at 4th place…. from the bottom!
So why this great love for Rust and this not so great love for C++?
C++ is a great language, you get awesome performance, you can build super fast applications with its rich function library. You can build a wide variety of applications from GUI apps to 3D graphics, games, desktop apps, as well as hard core computer vision applications.
On the other hand, Rust is pretty fast too. It can be used just about anywhere C++ can be used. It has a superb community and most of all, it’s memory safe! Rust’s concurrency capabilities have often been hailed as being superior to C++, and developers all around are eager to get their hands on Rust for this feature! Wondering how I know? I have access to a dashboard that puts a smile on my face, everytime I check the sales of Hands-On Concurrency with Rust! 😉 You should get the book too, you know. Coming back to our discussion, Rust’s build and dependency injection tool, Cargo, is a breeze to work with.
Why Rust is a winner
When compared with C++, the main advantage of using Rust is safety. C++ doesn’t protect its own abstractions, and so, doesn’t allow programmers to protect theirs either. Rust on the other hand, does both. If you make a mistake in C++, your program will technically have no meaning, which can result in arbitrary behavior. Unlike C++, Rust protects you from such dangers, so you can instead concentrate on solving problems.
If you’re already a C++ programmer, Rust will allow you to be more effective, while allowing those with little to no low level programming experience, to create things they might not have been capable of doing before. Mozilla was very wise in creating Rust, and the reason behind it was that they wanted web developers to have a practical and efficient language at hand, should they need to write low level code. Kudos to Mozilla!
Now back to the question – Will Rust replace C++?
Should C++ really worry about Rust replacing it someday? Honestly speaking, I think it has a pretty good shot at replacing C++. Rust is much better in several aspects, like memory safety, concurrency and it lets you think more carefully about memory usage and pointers. Rust will make you a better and more efficient programmer.
The transition is already happening in various fields. In game development, for example, AAA game studio, At Dawn Studios is switching entirely to Rust, after close to 3 decades of using C++. That’s a pretty huge step, considering there might be a lot of considerations and workarounds to figure out. But if you look at the conversations on Twitter, the Rust team is delighted at this move and is willing to offer any kind of support if need be. Don’t you just want to give the Rust team a massive bear hug?
IoT is another booming field, where Rust is finding rapid adoption. Hardware makers like Tessel provide support for Rust already. In terms of security, Microsoft created an open source repo on github, for an IoT Edge Security Daemon, written entirely in Rust.
Rust seems to be doing pretty well in the GUI department too, with tools like Piston. In fact, you might also find Rust being used along with popular GUI framework, Qt.
All this shows that Rust is seriously growing in adoption. While I say it might eventually be the next C++, it’s probably going to take years for that to happen. This is mainly because entire ecosystems are built on C++ and they will continue to be. Today there are many dead programming languages whose applications still live on and breed newer generations of developers. (I’m looking at you, COBOL!)
In this world of Polyglotism, if that’s even a word, the bigger question we should be asking is how much will we benefit if both C++ and Rust are implemented together. There is definitely a strong case for C++ developers to learn Rust. The question then really is: Do you want to be a programmer working in mature industries and projects or do you want to be a code developer working at the cutting edge of technological progress?
I’ll flip the original question and pose it to you:
Will you replace C++ with Rust?
Perform Advanced Programming with Rust
Learn a Framework; forget the language!
Firefox 61 builds on Firefox Quantum, adds Tab Warming, WebExtensions, and TLS 1.3
Really? Can you use Rust in embedded systems? What a joke! 9 of 10 computers in the world are embedded computers. Guess you don’t know what you’re talking about. And why did you cheet on the figures?
After 30 years of programming nobody has showed me in which ways C++ is “harder” than other languages.
That might speak more to your willingness to listen than the relative ease of languages.
Objectively, memory management is easier.
30 years of C++ can make one quite stingy and bitter. 😂
This discussion seems to come up every few years of why X language needs to replace C/C++ and this time the argument is centering on “memory safety”. No one wants to admit that in each and every case used in the article of unsafe memory use are programming errors on the part of the programmer. Overflow, re-use of freed pointers and indexing are errors and they are caught by the most rudimentary of tools called bounds checkers.
Furthermore, it isn’t like assumed “memory safe” languages do not have their own security problems, all caused by that same recurring issue of programmer error.
While I agree that Rust is a great language that provides the speed sorely lacking in previously touted “memory safe” languages like Java, Python or Ruby, C/C++ isn’t going to be replaced. There are certain areas where speed and efficiency are required over compiled bytecode, like operating systems.
Rust is a great language, but the main problem is most of industries and companies around the world don’t like to rewrite their codes, as you can see https://www.tiobe.com/tiobe-index/ c++ is coming up at 4th place, this time from the top!!! and rust is not placed even at top ten.
Although rust is awesome, but I don’t like to use it in my projects, because most of great libraries still under developing using c/c++, and what is the point of wrapping c/c++ codes via rust.
I’m game engine developer, I really want to switch my engine to rust, but I have to write a wrapper over most of c/c++ codes!!! unfortunately rust is too young.