2 ms·
I think the existence of operator overloading is a red-herring when criticizing C++. It's just syntax sugar; compare: cout << "foo" << "bar" << endl; cou
by aidenn0 6y ago
I think the existence of operator overloading is a red-herring when criticizing C++. It's just syntax sugar; compare:
cout << "foo" << "bar" << endl;
cout.out("foo").out("bar").out(endl);
I like the latter better than the former, but it's not like one is complete evil and the other is great.
Instead the issue with C++ is more complicated. It's a perfect storm of:
1. Easy to pretend it's "just like C" when really the increased quantity of features combine to make a major qualitative difference in how to use the tool
2. A large number of features that subtly (and sometimes not so subtly) encourage the programmer to do the wrong thing; many of the library changes from C++11 and on are about deprecating such features.
3. A lot of poorly implemented compilers for the first 20 years of its existence (when Alexandrescu's book came out, no existing compiler could compile all of the examples properly).
4. #2 and #3 combined to cause a lot of companies to choose their own (mutually incompatible) subset of C++'s features in the 90s.
#4 and #1 meant that C++ programmers regularly couldn't read code written by other C++ programmers. At some point, a subset of them stopped blaming "other C++ programmers" and started blaming the language.