C++ horrible aspects
Linus Torvalds described C++ as being a horrible language. C++ has its dark corners but I would choose it any day over any other language. This includes also Linus favorite C with its minimal support and security liabilities. Granted though there are many questionable aspects in C++:
- 'rvalue' references becoming 'lvalue' references. Not sure who invented this but he or she should be banned from the committee. It is super confusing that a reference type changes.
- universal references and perfect forwarding. Again a very confusing idea to reuse the 'rvalue' reference syntax. The reference collapsing rules doesn't make it easier either. As some stated it was better to use a different syntax for perfect forwarding.
- two phase lookup. this is a confusing rule which could have been circumvented by deferring template checking to instantiation time. The need to prefix template dependent types with 'typename' disappears. Making types and member functions (non) dependent is also not needed anymore since at instantiation time all type and context information is known to the compiler.
- lack of uniformity in STL. For example there is reset and clear. Some algorithm's have _if variants when taking functors; others not.
- functional programming style or object oriented. The regex functions are freestanding but why not make them member functions of regex? This prevents clutter of std namespace. It will probably also help Intellisense to build up its database which is very important these days in IDE's.
- uniform initialization. Again the committee made a mistake since constructors with initializer_list takes precedence over other constructors. This especially hurts the frequent used vector constructor which takes a size argument. The issue could be fixed by requiring double braces in case constructor invocation (e.g.std::vector<size_t>{{2}}). This is a slightly usability drawback but I prefer clarity over current situation.
- the ranges library has some strange aspects as well. Josuttis made a video about that.
- trailing return types. Now there are various syntax's to return from a function. This could have been solved by allowing the return type be dependent on template arguments without the necessity to specify them afterwards.
- concepts. One of the goal was to give clearer error messages. In practice they are as hard to decipher as in the old situation. On top of that the range library decided to use them as well which may result that something works with normal <algorithm> but with <ranges> one get a ton of compiler errors.
- contracts. It's not voted yet in the language. It introduces a new syntax and rules different from C++. The assert macro in function body already fulfills a great deal of pre- and post condition checking in plain C++ which every programmer understands. If tool-ability is the main driver for contracts why not formalize them with e.g. recognizable names (e.g. pre_assert; post_assert).
Besides these aspects C++ misses out on an extended standard library. Compared to .NET or Java the C++ standard library is thin. One frequently need 3th party libraries (e.g. Boost) for basic things. This could have been alleviated if there was a standard package manger like in Python with de facto libraries but again there isn't.
Despite all these issues I still prefer C++. One can decide to use what one is comfortable with and one needs. The exception mechanism is a topic of debate and many (embedded) environments choose not to use it. IMHO the constructor / destructor model is the most important aspect of C++. This alone gives the safety improvements over C through resource management and controlled access to raw buffers. Generic programming makes the STL possible which is another major reason to prefer C++ over C.
Linus Torvalds is a technical gifted person but his comments give the impression that he a hasn't a clue about C++. In the meantime some large applications and libraries (e.g. GCC; OpenCV) have made the shift and they never will go back to C. OpenCV code base is cleaned up with the move to C++: the manual and clumsy CvMemStorage and CvSeq are not needed anymore in C++. The Linux kernel could have benefited from the extra facilities C++ offers but the guy is stubborn as hell.