Difference between revisions of "C++"
Shedletsky (talk | contribs) |
Shedletsky (talk | contribs) |
||
Line 1: | Line 1: | ||
C++ (pronounced "see plus plus") is a general-purpose computer programming language. It is a statically typed free-form multi-paradigm language supporting procedural programming, data abstraction, object-oriented programming, and generic programming. During the 1990s, C++ became one of the most popular commercial programming languages. | C++ (pronounced "see plus plus") is a general-purpose computer programming language. It is a statically typed free-form multi-paradigm language supporting procedural programming, data abstraction, object-oriented programming, and generic programming. During the 1990s, C++ became one of the most popular commercial programming languages. | ||
==Differences in C++ from C== | |||
Features introduced in C++ include [[declaration|declarations]] as statements, function-like casts, <code>new</code>/<code>delete</code>, <code>bool</code>, reference types, <code>const</code>, <code>inline</code> functions, default arguments, function overloading, [[namespace (computer science)|namespaces]], classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), operator overloading, templates, the <code>::</code> operator, exception handling, and run-time type identification. | Features introduced in C++ include [[declaration|declarations]] as statements, function-like casts, <code>new</code>/<code>delete</code>, <code>bool</code>, reference types, <code>const</code>, <code>inline</code> functions, default arguments, function overloading, [[namespace (computer science)|namespaces]], classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), operator overloading, templates, the <code>::</code> operator, exception handling, and run-time type identification. | ||
Line 11: | Line 11: | ||
Several features of C++ were later adopted by C, including <code>const</code>, <code>inline</code>, declarations in <code>for</code> loops, and C++-style comments (using the <code>//</code> symbol). However, [[C programming language#C99|C99]] also introduced | Several features of C++ were later adopted by C, including <code>const</code>, <code>inline</code>, declarations in <code>for</code> loops, and C++-style comments (using the <code>//</code> symbol). However, [[C programming language#C99|C99]] also introduced | ||
features that do not exist in C++, such as [[variadic macro]]s and better handling of arrays as parameters. | features that do not exist in C++, such as [[variadic macro]]s and better handling of arrays as parameters. | ||
Revision as of 02:40, 21 September 2005
C++ (pronounced "see plus plus") is a general-purpose computer programming language. It is a statically typed free-form multi-paradigm language supporting procedural programming, data abstraction, object-oriented programming, and generic programming. During the 1990s, C++ became one of the most popular commercial programming languages.
Differences in C++ from C
Features introduced in C++ include declarations as statements, function-like casts, new
/delete
, bool
, reference types, const
, inline
functions, default arguments, function overloading, namespaces, classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), operator overloading, templates, the ::
operator, exception handling, and run-time type identification.
C++ also performs more type checking than C in several cases.
Comments starting with two slashes ("//") were originally part of C's predecessor, BCPL, and were reintroduced in C++.
Several features of C++ were later adopted by C, including const
, inline
, declarations in for
loops, and C++-style comments (using the //
symbol). However, C99 also introduced
features that do not exist in C++, such as variadic macros and better handling of arrays as parameters.
Design of C++
In The Design and Evolution of C++ ISBN 0-201-54330-3, Bjarne Stroustrup describes some rules that he uses for the design of C++. Knowing the rules helps to understand why C++ is the way it is. The following is a summary of the rules. Much more detail can be found in The Design and Evolution of C++.
- C++ is designed to be a statically typed, general-purpose language that is as efficient and portable as C
- C++ is designed to directly and comprehensively support multiple programming styles (procedural programming, data abstraction, object-oriented programming, and generic programming)
- C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly
- C++ is designed to be as compatible with C as possible, therefore providing a smooth transition from C
- C++ avoids features that are platform specific or not general purpose
- C++ does not incur overhead for features that are not used
- C++ is designed to function without a sophisticated programming environment
Please refer to the indepth book on C++ Internals by Stanley B. Lippman
(he worked on implementing/maintaining C-front the original C++ implementation
at Bell Labs).
"Inside the C++ Object Model" documents how the C++ compiler converts your program statements into an in-memory layout.