From Wikipedia, the free encyclopedia.
C++ (pronounced "see plus plus") is a general purpose computer programming language. It is a static-type-checking 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.
Bell Labs' Bjarne Stroustrup developed C++ (originally named "C with Classes") during the 1980s as an enhancement to the C programming language. Enhancements started with the addition of classes, followed by among many features, virtual functions, operator overloading, multiple inheritance, templates, and exception handling. The C++ programming language standard was ratified in 1998 (ISO/IEC 14882-1998).
Technical Overview
The 1998 C++ Standard consists of two parts: the Core Language and the Standard Library; the latter includes the Standard Template Library and C's Standard Library. Many C++ libraries exist which are not part of the Standard, such as Boost. Also, non-Standard libraries written in C can generally be used by C++ programs.
New language features in C++ as compared to C
New features include declarations as statements, new casts, new/delete, bool, classes, derived classes, virtual functions, abstract classes, access control (private, protected, public, friend), const, mutable, operator overloading, templates, inline functions, default arguments, function overloading, namespaces, operator ::, exception handling, and run-time type identification.
// comments were originally part of C's predecessor, BCPL, and were reintroduced into C++.
The C++ standard library mostly forms a superset of the C standard library. A large part of the C++ library comprises the Standard Template Library (STL). The STL provides such useful tools as iterators (which resemble high-level pointers) and containers (which resemble arrays that can automatically grow to include new elements). As in C, the features of the library are accessed by using the
As Stroustrup designed C with Classes (later C++), he also wrote Cfront, a compiler that generates C source codes from C with Classes source codes. The first commercial release occurred in October 1985.
In 1982, the name of the language was changed from C with Classes to C++. New features that were added to the language included virtual functions, function name and operator overloading, references, constants, user-controlled free-store memory control, improved type checking, and new comment style (//). In 1985, the first edition of The C++ Programming Language was released, providing an important reference to the language, as there was not yet an official standard yet. In 1989 Release 2.0 of C++ was released. New features included multiple inheritance, abstract classes, static member functions, const member functions, and protected members. In 1990, The Annotated C++ Reference Manual was released and provided the basis for the future standard. Late addition of features included templates, exceptions, namespaces, new casts, and a Boolean type.
As the C++ language evolved, a standard library also evolved with it. First addition to the C++ standard library was the stream I/O library which provided facilities to replace the traditional C functions such as printf and scanf. Later, among the most significant additions to the standard library, was the Standard Template Library.
After years of work, a joint ANSI-ISO committee standardized C++, in 1998 (ISO/IEC 14882-1998).
C++ continues to evolve to meet future requirements. While compiler vendors still struggle to support all of C++'s features (circa 2004), the situation improved significantly from 1998 to 2003. One group in particular works to make the most of C++ in its current form and advise the C++ standards commitee which features work well and which need improving: Boost.org. Current work indicates that C++ will capitalize on its multi-paradigm nature more and more. The work at Boost.org, for example, is greatly expanding C++'s functional and metaprogramming capabilities. C++ still lacks a standard for name decoration, making object code produced by different compilers incompatible.
Some C programmers have noted that if the statements
The Standard does not say what the return value of main() actually means. Traditionally, it is interpreted as the return value of the program itself. The Standard guarantees that returning zero from main() indicates successful termination.
Indicating unsuccessful termination from a C++ program is traditionally done by returning a nonzero value. This is not quite correct from a language-lawyer standpoint, however.
int main() {
std::cout << "Wikipedia, the free encylopedia!" << std::endl;
}
C++ Library
#include directive to include a standard header. C++ provides sixty-nine standard headers, of which nineteen are deprecated. A project known as STLPort has created a single set of public domain source code source for the STL. The binary images are available online for most platforms.Ownership of C++
Nobody owns C++. Stroustrup and AT&T receive no royalties for the usage of C++.History of C++
Stroustrup began work on C with Classes in 1979. The idea of creating a new language originated from Stroustrup's experience programming for his Ph.D. thesis. Stroustrup found that Simula had features that were very helpful for large software development but was too slow for practical uses, while BCPL was fast but too low level and unsuitable for large software development. When Stroustrup started working in Bell Labs, he had the problem of analyzing the UNIX kernel with respect to distributed computing. Remembering his Ph.D. experience, Stroustrup set out to enhance the C language with Simula-like features. C was chosen because it is general-purpose, fast and portable. At first, class (with data encapsulation), derived class, strong type checking, inlining, and default argument were features added to C.Future Development
History of the Name "C++"
This name is credited to Rick Mascitti (mid-1983) and was first used in December 1983. Earlier, during the research period, the developing language had been referred to as "C with Classeses". The final name stems from C's "++" operator (which increments the value of a variable) and a common naming convention of using "+" to indicate an enhanced computer program, for example: "Wikipedia+". According to Stroustrup: "the name signifies the evolutionary nature of the changes from C". C+ had earlier named an unrelated program. While most C code consists of valid C++, C does not form a subset of C++.x=3; and y=x++; are executed, then x and 4
y3; x is incremented after its value is assigned to y. However, if the second statement is y=++x;, then y=4 and x=4. Following such reasoning, a more proper name for C++ might actually be ++C. However, c++ and ++c both increment c, and, on its own line, the form c++ is more common than ++c. The pedantic may note that the introduction of C++ did not change the C language itself and the most accurate name might then be "C+1".C++ Examples
Example 1
This is an example of a program which does nothing. It begins executing and immediately terminates. It consists of one thing: a main() function. main() is the designated start of a C++ program.int main() {
return 0;
}The C++ Standard requires that main() returns type int. A program which uses any other return type for main() is not Standard C++.Example 2
This program also does nothing, but is less verbose.int main() {
}In C++, falling off of the end of main() is equivalent to return 0;. This is not true for any function other than main().Example 3
This is an example of a Hello world program, which displays a message and then terminates.#include
Check out more C++ examples.See also
References
External links

