MITB Banner

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.
Share
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?

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”.

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. 

PS: The story was written using a keyboard.
Share
Picture of Anirudh VK

Anirudh VK

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

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

Upcoming Large format Conference

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Courses & Careers

Become a Certified Generative AI Engineer

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India