2 ms·
In theory C++ is a good language, beautiful, even, with its sheer power of abstraction. But nothing is free, and the mental overhead of using this power is enor
by Koshkin 8y ago
In theory C++ is a good language, beautiful, even, with its sheer power of abstraction. But nothing is free, and the mental overhead of using this power is enormous. To avoid it, developers (and designers of other, "easier" languages) transfer the overhead onto the run time. With C++ this is done by heavily relying on the data structures and the algorithms that are provided by the C++ standard library. One problem with this is that the most popular (and useful) standard structures rely, by default, on dynamic memory management. While it is possible to customize the way these structures manage memory so as to make it less taxing, this also would create a mental overhead - the one that the developer is trying to avoid in the first place. Another problem that people rarely think about is that the pervasive adherence to the RAII pattern does not come without a run time penalty, either. Constructors are often redundant and are used for "bureaucratic" reasons; destructors, on the other hand, are always "eager," so they would be used for releasing resources, such as memory, regardless of whether this is actually necessary or not. (In comparison, garbage collection is "lazy.") Yet another problem is that the use of templates (which is one of the biggest attractions in the C++ world) leads to an increase of the code size. Again, this is not to say that C++ is a bad language; it's just that it can be a bad choice.