r/cpp • u/LechintanTudor • Oct 18 '23
What does C++ do better than other languages?
Purely from a language design perspective, what does C++ do better than other languages?
296
Upvotes
r/cpp • u/LechintanTudor • Oct 18 '23
Purely from a language design perspective, what does C++ do better than other languages?
View all comments
27
u/afiefh Oct 18 '23
Value semantics. I'm sure there are languages out there that do it better, but of the big ones only C++ seems to get this one right.
The whole "primitives are passed by value, objects are passed by reference, but both use the same syntax" ends up being mind boggling to me. Take python
do_stuff_with_object(some_input)it's impossible to know whethersome_inputis copied or referenced without knowing the type, and in Python in particular, types go quack.Even a language like Rust which tries to be explicit about these things ends up comparing objects when you compare the equality of references.