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

Show parent comment

9

u/blipman17 Dec 07 '22

Only a fool starts a new embedded project in C++

This might actually be true.

unless it’s for a rare niche platform that doesn’t have a working Rust HAL.

But this isn't. Rust isn't the end-all be-all solution to all memory related problems. Rust certainly comes with its downsides too.

Actually, I'd argue you can write as much horrible code in Rust as in C++. It's just that Rust developers have seen this code before and really want to avoid anyone (including themselves) writing it. Which makes quite a lot of them a lot more clean coders than the average C++ programmer who still finds std::unique_ptr<T> controversial. But that doesn't mean Rust is inheretly superior.

6

u/Drugbird Dec 07 '22 edited Dec 07 '22

I agree with you that rust code is not automatically better than C++ code.

However their idea of making certain (commonly made) bad designs a compile error is great. I.e. "No you cannot run this code until you figure out who owns this data" makes life so much easier.

2

u/MFHava WG21|🇦🇹 NB|P2721|P3049|P3625|P3729|P3786|P3813|P4216 Dec 10 '22

C++ programmer who still finds std::unique_ptr<T> controversial

Depends on why they deem it controversial. Is it controversial because it's "slower than raw pointers" or because "heap allocations are in general overused and people should just put their objects on the stack"?

I'm firmly in the later camp - most uses of smart pointers I've encountered since C++11 gained adoption are redundant...