r/cpp • • Dec 07 '22

C++ overtakes Java in language popularity index

https://www.infoworld.com/article/3682141/c-plus-plus-overtakes-java-in-language-popularity-index.html
382 Upvotes

137 comments sorted by

View all comments

-8

u/WilsonWeber Dec 07 '22

But Rust is Growing So Fast

I think Rust Overtake C++ in future

3

u/konm123 Dec 07 '22

I do not think Rust will overtake c++, because in the end it boils down to what problems we are solving with the language - it is is measly implementation specific things. By far, most of the development effort goes into concept engineering and design. C++ has been around a long time, new things are nicer than ever before. With a decent static analyzer for C++, Rust loses its edge over C++ because suddenly, your static analyzer will report most of the memory problems as Rust does.

It really is not a competition. I see future for the both languages. For new projects, absolutely, go ahead and start implementing them in Rust code.

Ada/SPARK is probably most serious potential overtaker for Rust to look out for. More and more big companies have already started looking towards Ada/SPARK (such as NVidia for its firmware). It gives you everything Rust promises and so much more with its built-in static analysis. Moreover, it is much easier to get into and write - Ada is relatively simple language, much simpler than C++ or Rust.

So, in terms of safety, I would summarize: Ada/SPARK > Rust > C++, and I see all of them being actively used in the future.

5

u/WormRabbit Dec 07 '22

Ada/SPARK doesn't have a future. It has no network effects, and those dominate in modern language popularity. It may still be used successfully in some niche contexts.

With regards to static analyzers for C++, I imagine the Android team uses them all, and they have this to say:

In Android 13, about 21% of all new native code (C/C++/Rust) is in Rust. There are approximately 1.5 million total lines of Rust code in AOSP across new functionality and components such as Keystore2, the new Ultra-wideband (UWB) stack, DNS-over-HTTP3, Android’s Virtualization framework (AVF), and various other components and their open source dependencies.

To date, there have been zero memory safety vulnerabilities discovered in Android’s Rust code.

Historical vulnerability density is greater than 1/kLOC (1 vulnerability per thousand lines of code) in many of Android’s C/C++ components (e.g. media, Bluetooth, NFC, etc). 

In 2022, despite only representing 36% of vulnerabilities in the security bulletin, memory-safety vulnerabilities accounted for 86% of our critical severity security vulnerabilities, our highest rating, and 89% of our remotely exploitable vulnerabilities. Over the past few years, memory safety vulnerabilities have accounted for 78% of confirmed exploited “in-the-wild” vulnerabilities on Android devices.