Is it time to retire C and C++ for Rust in new programs? (2024)

Column We all know that the Rust language has become much more popular. By Slashdata's count, Rust users have nearly tripled in the past 24 months.

Mark Russinovich, Microsoft Azure's CTO, tweeted that "it's time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC language is required. For the sake of security and reliability. The industry should declare those languages as deprecated."

Them's fighting words!

What prompted this? As noted here, it's not really a desire to start another endless programming language war – see vi vs EMACS, tabs vs spaces, and Java vs Python. No, I think what sparked his comment was that Linus Torvalds has given his blessing to bring Rust code into the Linux kernel, starting with Linux 6.1.

If the Linux kernel developers, the programmers of the most successful C project of all time, are embracing Rust, why not the author of Windows Sysinternal Tools?

Mind you, Russinovich isn't suggesting that we trash everything already written in C or C++ and rewrite it in Rust in our copious free time. Far from it. As he tweeted after he challenged the industry to say goodbye to C and C++: "There is an enormous amount of C/C++ that will be maintained and evolve for decades (or longer). Last night I coded a feature for Handle, adding to the roughly 85,000 lines of Sysinternals C/C++ code I've written. That said, I'll bias towards Rust for new tools."

He's right, of course. When I first started programming, everyone said COBOL was history. Forty years later, COBOL is alive and well, and its programmers are still raking in the money. So there!

Languages never die. They just stop being sexy.

That said, there are excellent reasons to retire C and C++ in favor of Rust. First, Rust was designed with performance and safety in mind. The C family is all about speed and more speed. Security came a long way second.

  • Rust is eating into our systems, and it's a good thing
  • Linus Torvalds predicts Linux Kernel 6.0 debut next week, dispels fear of delays
  • In Rust We Trust: Microsoft Azure CTO shuns C and C++
  • Linux luminaries discuss efforts to bring Rust to the kernel

True, you can write securely in C or C++. For example, you can use a more secure language variant such as SEI CERT C or use more secure guidelines in working with a language such as the C++ Core Guidelines. And, as Bjarne Stroustrup, C++'s creator, told The Register recently: "We can now achieve guaranteed perfect type and memory safety in ISO C++."

Indeed, you could always write perfectly secure C and C++ code. It's just that it has never, ever been easy. Both languages make it much too easy to make memory errors. They include Invalid heap and stack memory access; memory leaks; mismatched memory allocation and deallocation; and uninitialized memory access. And those are just the common blunders I've made! As Naveen Gv, an Intel technical consulting engineer, put it: "Memory errors occur very commonly in C and C++ applications, and … can be hard to reproduce, hard to debug, and potentially expensive to correct as well."

Both languages are "memory-unsafe." They give developers fine-grained control of their application's memory, but with great power comes great potential for trouble. One memory snowball slip-up can lead to an avalanche of errors.

These aren't just theoretical errors. They happen all the time. In 2019, Microsoft confessed that 70 percent of its Common Vulnerabilities and Exposures (CVE) security problems had been caused by developers making memory corruption mistakes in their C and C++ code.

As much as I like to make fun of Microsoft security, this problem is far from unique to Microsoft. Google's developers have found the same percentage of memory problems in its Chromium/Chrome web browser code. I'm sure it's that bad in pretty much everything written in C or C++.

Rust, on the other hand, is a memory-safe language. Sure, you can still make security blunders with it. You can in any language. But, and this is the important part, it's much harder to make the kind of simple memory missteps that bedevil C and C++ applications.

That's why, years before Rust started making headlines, Google and Microsoft both started considering replacing C and C++ with Rust. Now Linux is embracing Rust as well.

Besides security, Rust has the advantage of making it easier to write concurrent programs. Rust was written for a world with containers and the cloud, while C was written for 16-bit DEC PDP-11 minicomputers. Now, both C and C++ are very flexible, but we're a long way from single processor/single core computers!

That said, Rust won't replace its older brothers tomorrow. It will take years – indeed decades – but it will happen. We've ignored security for generations, but now that our entire economy depends on secure technology, we can't afford to be so cavalier with our programs. ®

Is it time to retire C and C++ for Rust in new programs? (2024)
Top Articles
Government Shutdown 2024 Update: Government Averts Closure
Common Stock: What It Is, Different Types, vs. Preferred Stock
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
Non Sequitur
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6344

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.