1.1.  Overview of C++

[ fromfile: cppintro.xml id: overview ]

C++ was originally written as an extension of C by means of a series of preprocessor macros and known as C with Classes. After many years of evolution and refinement, it now extends C by adding several higher-level features such as strong typing, data abstraction, references, operator and function overloading, and considerable support for object-oriented programming.

C++ retains the key features that have made C such a popular and successful language: speed, efficiency, and a wide range of expressiveness that enables programming at many levels, from the lowest level (such as direct operating system calls or bitwise operations) to the highest level (such as manipulating containers of large complex objects).

A fundamental design decision was made at the beginning for C++: New language features should not cause a runtime penalty for C code that does not use them.[2] There are many advanced features in C++ that enable the programmer to write readable, reusable, object-oriented programs; and using those features invariably causes the compiler to do lots of extra work. But longer compile times is a small price to pay for the power and maintainability of the resulting code. Some features have a runtime cost if they are used, but a C program compiled by a C++ compiler should run just as fast as it would if compiled by a C compiler. New features enable greater optimization of generated code.



[2] Unfortunately, exception-handling broke this rule and does cause a bit of overhead if enabled. This is why many libraries do not use exceptions.