Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
The C++ programming language


1. The C++ programming language

2. C++
C++ logoC++ is a general purpose multi-platform imperative programming language.

C++ is an extension of the C programming language, originally called "C with classes" but renamed (in 1983). C++ after the increment operator of C. C++ is an incremental improvement over C.

Most C code can be run as C++ code, but there are exceptions (e.g., type safety rules).

The file extension of C++ code files is cpp.

3. Brian Stoustrup
C++ was developed by Bjarne Stoustrup.

Later criticisms of C++ include the fact that Bjarne went with almost every committee recommendation.

Since good programming style dictated that subsets of C++ be used, this resulted in different ways of using C++.

4. Memory management
C++, like C, allows the programmer access to the underlying hardware, memory, etc., but that comes at a price of complexity and more changes to get into trouble while writing "efficient" code.

The new and delete keywords do help somewhat.

5. Templates
Templates allow a form of generic programming.

Note that in dynamically typed languages such as Python, JavaScript, Lua, etc., there is no need for templates or generic programming. It happens automatically.

But for more strongly typed languages (e.g., Java, C#, etc.) the generic capability is needed.

Templates are a form of macro substitution (e.g., string rewriting) but with some knowledge from the program doing the substituting.

6. Turing completeness
A Turing (named after Alan Turing) complete system can do the computation of a general purpose computer.

The C preprocessor is not Turing complete.

The C++ template (compile-time) mechanism is Turing complete.

7. Programming
C++ supports the following.

8. Multiple inheritance
Multiple inheritance allows subclasses to inherit form multiple ancestor classes.

C++ supports multiple inheritance.

Humans have trouble with multiple inheritance programming. This creates problems in both writing such code and understanding such code.

Some languages (e.g., Java, C#, etc.) manage this complexity via interfaces.

9. Operator overloading
C++ supports operator overloading, which can be both powerful but yet confusing.

10. Lambda expressions
A lambda expression allows a function (named or unnamed) to be passed along with the environment in which the function was defined.

In general, this feature is powerful but can require garbage collection of un-referenced objects, etc. C++ does not include garbage collection.

11. Exception handling
Exception handling is a powerful way to trap and handle exceptions, but can be tricky to use correctly.

Some style guides (e.g., Google, Apple, Microsoft, etc.) do not recommend (or forbid) the try catch exception handling.

12. Alan Kay: Object-oriented
Alan Kay was the originator of object-oriented, having developed the Smalltalk system in 1971, since "Children should program in smalltalk".

13. End of page