Old Wine, New Bottle: Rust Copies C, C++, Topples Legacy’s Crown

Replacing C is blasphemy for most coders, but Rust might make it happen.
Listen to this story

C and C++ are among the most pervasive programming languages in the software industry today, with over 6.3 million developers using the language to code just about everything. Now, there is another language that has proven to be a worthy competitor to C and C++; Rust.

Developed by a Mozilla Research employee Grayson Hoare, Rust has grown into its own over the past 15 years of its existence. From being picked up by tech giants like AWS, Meta, and Atlassian to supporting Web3 ecosystems like Ethereum and Solana, Rust is quickly becoming a superstar in the development world. 

Moreover, the language has also been voted as the most-loved programming language in Stack Overflow’s Developer Survey for the past seven years. But what makes this language so loved and powerful and does it have the capability to replace C?

THE BELAMY

Sign up for your weekly dose of what's up in emerging technology.
Read: Should we call Rust a Failed Programming Language?

The grandchild of C

The language borrowed the best elements from multiple programming languages, such as the easy-to-use syntax of C and C++ along with the functional nature of languages like Haskell. This piecemeal approach resulted in Rust collating many of the developer’s beloved features while keeping a focus on fast execution and safe code.

In the blog post announcing Rust’s 1.0 release, the team said, “[Rust’s] type system. . . represents a refinement and codification of best practices that have been hammered out by generations of C and C++ programmers”.


Download our Mobile App



In addition to its heritage from other languages, Rust has certain game-changing features of its own. For instance, Rust has granular access to low-level code while also toeing the line between capability and abstraction with its high-level capabilities. The language also boasts a robust optimiser and wields many zero-cost abstractions to cut down on runtime. 

The language was built from the ground up to enable concurrent programming, a killer feature that makes it a must-have in the HPC field. Rust is also extremely focused on pushing developers to create memory-safe code, as it does not have in-built garbage collection. 

The programme instead encourages memory borrowing and lending techniques, along with clear-set rules for when a variable will be dropped from memory. The focus on memory safety cuts down on the amount of bugs in the final product, saving on time and resources when it comes to deployment. 

On the other hand, C and C++ suffer from feature creep brought on by years of haphazard updates. These old languages also lack the features that most developers take for granted in modern languages, like easy integrations for libraries, efficient memory management techniques and run-time checking. Reddit user Matthieum sums it up perfectly in a comment, stating,

“C++ is a mess. It’s no one’s fault, really, mostly a historical accident, but it’s something you pay on a daily basis. There was not enough insanity in C so the developers of C++ decided to add some more. Did I talk about memory safety? Data-races? No. There’s little point really. To tame C++, one must gaze into the abyss.”

Rust’s lack of garbage collection not only makes programmes run faster, it also makes it a viable drop-in replacement for C. Moreover, its nature as a language skirting the line between high-level and low-level makes it a good fit for applications that already use C and C++.

Rust vs C/C++

Will C be relegated to the past?

Rust has many of the capabilities of C and C++, along with similar syntax. Further, due to the intrinsically safe nature of the language, even new developers can create complex code without worrying about application-breaking bugs. In addition to this, Rust also comes with ‘Cargo’, a build system and package manager, thereby making importing code easy. 

Over the past few years, tech giants have also made it a point to integrate Rust into many of their offerings. AWS FireCracker VMM is built completely on Rust, and many other services like S3, EC2, CloudFront, and Route 53 all use Rust for deployment. The language has also been introduced into the Linux Kernel while Azure has largely shifted to using Rust over C citing security concerns. 

When looking at the capabilities of Rust, it is highly possible that this language might become a stand-in for C in the near future. The Rust community has also created resources to port C/C++ code to Rust, and another member has created Corrode, a translation layer between C and Rust. 

However, as seen with legacy languages like Fortran and COBOL, the industry has a lot of inertia when moving away from old systems. At the last estimate, there are approximately 10 billion lines of C++ code in a production environment. This implies that there is an equally strong force against switching to any language that is not C++. 

However, with enough momentum behind Rust, it might become the status quo programming language of the future, with C and C++ being delegated to their rightful legacy position. 

More Great AIM Stories

Anirudh VK
I am an AI enthusiast and love keeping up with the latest events in the space. I love video games and pizza.

AIM Upcoming Events

Early Bird Passes expire on 3rd Feb

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
AIM TOP STORIES

Is AI sexist?

Genderify, launched in 2020, determines the gender of a user by analysing their name, username and email address using AI.