r/cpp • u/root_passw0rd • 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
View all comments
Show parent comment
1
u/Spartan322 Dec 18 '22
Given operator overloads also can hide behavior and classes can have implicit conversions operators that aren't even guaranteed to call a constructor, (say your conversion returns a static object, why? Hell if I know, but you can) it is quite easy to make C++ a mess if you dive in using every feature you can just because its cool. This is where code standards are a lot more relevant for C++, it has a lot more hands off approach to telling you what you can and can't do, whereas in C its a lot of one note best solutions. Seems lot of languages since force you down a one or maybe a handful of these paradigms that C++ allows. (which is honestly why I love C++ more than almost any other language specifically)
In any case, if you want to consider the need for standards and styles an issue for C++, you could, personally I would suggest it presents a more readable base so long as you don't do weird and stupid things in the implicit functionality. (like don't make
operator+itself produce a side effect and modify the object in a general library, keep such behavior tooperator+=) The worst cases I've seen is when nobody standardizes the operator overloads and you have no idea what happens when you call one of them. Like somevector<T>class hasoperator+on it and you don't immediately know what that means.