Main Page | See live article | Alphabetical index

C Plus Plus

C++ (pronounced "see plus plus"; originally known as: C with Classeses) is a computer programming language; it is an extensible and procedural free-form multi-paradigm language, with object-oriented extensions. During the 1990s, C++ became one of the most popular commercial programming languages.

Bell Labs' Bjarne Stroustrup developed C++, during the 1980s, as an upgraded "object-oriented" version of C. Along with its object-oriented design, today's C++ differs from C in its support for generic programming and template metaprogramming; via alias types, in-line expansion, templates, and //-commenting (though note that C has subsequently adopted in-line expansion and //-commenting).

Table of contents
1 History of C++
2 Technical Overview
3 History of the Name "C++"
4 4 and y
5 Ownership of C++
6 C++ Examples
7 C++ Library
8 Future Development
9 See also
10 References
11 External links

History of C++

Stroustrup began work on the language in 1979, inspired by Simula67. AT&T first used the language in August 1983. The original compiler was Cfront. The first commercial release occurred in October 1985. A joint ANSI-ISO committee standardized C++, 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.

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++.

Some C programmers have noted that if the statements x=3; and y=x++; are executed, then x

4 and y

3; 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".

Ownership of C++

Nobody owns C++. Stroustrup and AT&T receive no royalties for the usage of C++.

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++.

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.

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  // needed for std::cout

int main() { std::cout << "Wikipedia, the free encylopedia!\\n"; return 0; }

Check out more C++ examples.

C++ Library

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 #include directive to include a standard header. C++ provides sixty-nine standard headers, of which nineteen are deprecated.

Future Development

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 committee 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.

See also

References

External links