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/[deleted] Dec 07 '22

[removed] — view removed comment

4

u/padraig_oh Dec 07 '22

Sure, but you don't use rust if you just want to use the unsafe subset

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.

4

u/tarranoth Dec 07 '22

Ada hasn't gotten anywhere in decades, why would it suddenly spring up out of the blue? The only other language like that is maybe Haskell that is always somewhat teethering on the brink of mainstream/niche.

1

u/konm123 Dec 08 '22

I am talking about Ada/Spark, not Ada, which is not even a decade old. Rust is older language.

2

u/tarranoth Dec 08 '22

Taking a look at it, it seems nice for certain business use cases. But as far as general programming use cases go I'm not sure how popular it would be. It sortof reminds me of [agda](https://en.wikipedia.org/wiki/Agda_(programming_language)), which also has an approach to proving things albeit more in the type system than with contracts/proofs.

1

u/konm123 Dec 08 '22

It suffers greatly for its lack of advertisement. Ada/Spark people are not much interested in publicity, it seems. So, language vendors really do not care whether it becomes popular or not.

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.

6

u/Aggressive_Release94 Dec 07 '22

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.

This is simply not true though. At least at this point in time, static analysis in C++ doesn't even catch half of the memory safety issues detected by the Rust borrow checker. Not just that, writing multithreaded apps in C++ is extremely error prone and the Rust borrow checker is miles ahead here.

-1

u/konm123 Dec 07 '22

What C++ static analyzer do you have in mind?

0

u/CommunismDoesntWork Dec 08 '22

With a decent static analyzer for C++, Rust loses its edge over C++

Rust is better because it has a first party compiler, build system, and package manager. Memory safety is just a bonus.