3 ms·
> If someone wanted speed of execution, why not use Ansi C? If someone wanted object oriented programming, why not the myriad other languages? Because they wa
by azth 14y ago
> If someone wanted speed of execution, why not use Ansi C? If someone wanted object oriented programming, why not the myriad other languages?
Because they want both speed and OO programming? :)
C++ is a multi-paradigm language. It has more abstractions than C, while retaining the ability to get down to the metal when you need to. Arguably, these higher level features are desirable when working on larger code bases. C++ also has features that make it easier to write clean and correct code (such as RAII). Templates and operator overloading makes for writing expressive libraries. I remember reading and article that compared C and C++ in the context of a matrix library. The C++ code was much more concise and readable, and was easier to get right compared to C, mainly due to those two features.
Furthermore, C++ can actually be faster than C. The canonical example is the templated std::sort() vs C's quicksort(). The C++ compiler is able to inline the comparator argument to the former, whereas qsort() takes a function pointer.