C++: Difference between revisions
rv my own previous History reorg, due to uncertainty about the change |
|||
Line 755: | Line 755: | ||
* [[freenode]]'s [http://jcatki.no-ip.org/fncpp/ ##C++] channel wiki |
* [[freenode]]'s [http://jcatki.no-ip.org/fncpp/ ##C++] channel wiki |
||
* Article "[http://david.tribble.com/text/cdiffs.htm Incompatibilities Between ISO C and ISO C++]" by [[David R. Tribble]] |
* Article "[http://david.tribble.com/text/cdiffs.htm Incompatibilities Between ISO C and ISO C++]" by [[David R. Tribble]] |
||
*C++ internals explained via a C++ to C mapping: |
|||
** [http://www.eventhelix.com/RealtimeMantra/basics/ComparingCPPAndCPerformance.htm Classes and Methods Mapped to C] |
|||
** [http://www.eventhelix.com/RealtimeMantra/basics/ComparingCPPAndCPerformance2.htm Inheritance and Virtual Functions Mapped to C] |
|||
{{Major programming languages small}} |
{{Major programming languages small}} |
Revision as of 13:01, 19 January 2006
Paradigm | object-oriented |
---|---|
Typing discipline | strong, static |
Website | isocpp |
Influenced by | |
C | |
Influenced | |
C#, Java |
C++ (pronounced "see plus plus", IPA: [siː plʌs plʌs]) 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. Since the 1990s, C++ has been one of the most popular commercial programming languages.
Bell Labs' Bjarne Stroustrup developed C++ (originally named "C with Classes") in 1983 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 as ISO/IEC 14882:1998, the current version of which is the 2003 version, ISO/IEC 14882:2003. A new version of the standard (known informally as C++0x) is being developed.
History
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. Besides C and Simula some other languages which inspired him were: ALGOL 68, Ada, CLU and ML. At first, class (with data encapsulation), derived class, strong type checking, inlining, and default argument were features added to C, via the Cfront front-end. The first commercial release occurred in October 1985.
In 1983, 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. 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. The 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). For some years after the official release of the standard in 1998, the committee processed defect reports, and published a corrected version of the C++ standard in 2003. In 2005, a technical report, called the "Library Technical Report 1" (often known as TR1 for short) was released. While not an official part of the standard, it gives a number of extensions to the standard library which are expected to be included in the next version of C++. Support for TR1 is growing in almost all currently maintained C++ compilers.
No one owns the C++ language; it is royalty-free. The standard document itself is, however, not available for free.
Future development
C++ continues to evolve to meet future requirements. One group in particular, Boost.org, works to make the most of C++ in its current form and advises the C++ standards committee as to which features work well and which need improving. 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. The C++ standard does not cover implementation of name decoration, exception handling, and other implementation-specific features, making object code produced by different compilers incompatible; there are, however, 3rd-party standards for particular machines or OSs which attempt to standardise compilers on those platforms, for example C++ ABI.
C++ compilers still struggle to support the entire C++ standard, especially in the area of templates — a part of the language that was more-or-less entirely conceived by the standards committee. One particular point of contention is the export keyword, intended to allow template definitions to be separated from their declarations. The first compiler to implement export was Comeau C++, in early 2003 (5 years after the release of the standard); in 2004, beta compiler of Borland C++ Builder X was also released with export. Both of these compilers are based on the EDG C++ frontend. It should also be noted that many C++ books provide example code for implementing the keyword export (Ivor Horton's Beginning ANSI C++, pg. 827) which will not compile, but there is no reference to the problem with the keyword export mentioned. Other compilers such as Microsoft Visual C++ and GCC do not support it at all. Herb Sutter, secretary of the C++ standards committee, has recommended that export be removed from future versions of the C++ standard [1], but finally the decision was made to leave it in the C++ standard.
Other template issues include constructions such as partial template specialisation, which was poorly supported for several years after the C++ standard was released.
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 Classes". 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+ was the name of an earlier, unrelated programming language.
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
. However, the introduction of C++ did not change the C language itself, so an even more accurate name might be "C+1".
Stroustrup addresses this debate in the preface of later editions of his book, The C++ Programming Language, adding that another interpretation of the name "C++" might be inferred from the appendix of George Orwell's Nineteen Eighty-Four. Of the three segments of the fictional language Newspeak, the "C vocabulary" is the one dedicated to technical terms and jargon. "Doubleplus" is the superlative modifier for Newspeak adjectives. Thus, "C++" might hold the meaning "most extremely technical or jargonous" in Newspeak.
When Rick Mascitti was questioned informally in 1992 about the naming, he indicated that it was given in a tongue-in-cheek spirit. He never thought that it would become the formal name of the language.
Philosophy
In The Design and Evolution of C++ (1994), 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
Stanley B. Lippman documents in his in-depth book "Inside the C++ Object Model" (1996) how compilers convert C++ program statements into an in-memory layout. Lippman worked on implementing and maintaining C-front, the original C++ implementation at Bell Labs.
Syntax
Features introduced in C++
Compared to the C language, C++ introduced extra features, including declarations as statements, function-like casts, new
/delete
, bool
, reference types, 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.
Despite popular belief, C++ did not introduce the const
keyword first. Const was formally added to C shortly before it was adopted by C++.
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 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.
A very common source of confusion is a subtle terminology issue: because of its derivation from C, in C++ the term object means memory area, just like in C, and not class instance, which is what it means in most other object oriented languages. For example in both C and C++ the line
int i;
defines an object of type int, that is the memory area where the value of the variable i will be stored on assignment.
Sample code
Minimal program
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. Note that the Standard does not require the return explicitly; the lack of a return is assumed to mean return 0. However, many compilers do not support this and mark it as an error.
Indicating unsuccessful termination from a C++ program is done by returning the EXIT_FAILURE constant, which is defined in the cstddef standard header.
Sometimes the passing of parameters to the main function is desirable. In this case one would write the following code:
int main(int argc, char* argv[]) { return 0; }
Where int argc is the number of parameters and argv is an array of strings that contains the different parameters.
Hello world program
This is an example of a Hello world program, which uses the C++ standard library (not STL) cout facility to display a message and then terminates.
#include <iostream> // Required for std::cout #include <ostream> // Required for std::operator<< int main() { std::cout << "Hello World!" << std::endl; return 0; }
Input/output streams
#include <iostream> #include <istream> #include <ostream>
int main() { int response;
std::cout << "Are you feeling well? (1=Yes, 2=No)" << std::endl; std::cin >> response;
if (response == 1) { std::cout << "I am glad that you are fine."; } else { std::cout << "Oh, I am so sorry."; }
return 0; }
This program asks for a user input (with cin), and stores the subsequent information in the 'response' variable. This is then used in the if block to make a decision as to which message should be displayed.
Standard template library
Modern C++ can accomplish advanced tasks in a simple manner. This example demonstrates the use of the C++ Standard Template Library containers map and vector, among other features.
#include <algorithm> // std::for_each() #include <iostream> // std::cout #include <map> // std::map<> and std::pair<> #include <string> // std::string #include <vector> // std::vector<>
using namespace std; // import "std" namespace into global namespace typedef string Name; // Name becomes a synonym of a string typedef vector<string> ItemList; // ItemList becomes a synonym of a vector of strings
void display_item_count(const pair<Name, ItemList>& person) { // the name is referred as person.first as being the first element of the pair // the same with ItemList (referred as person.second) cout << person.first << " is carrying " << person.second.size() << " items" << endl; }
int main() { // Declare a map with string keys and vectors of strings as data map<Name, ItemList> items;
// Add some people to the map and let them carry some items items["Anya"].push_back("scarf"); items["Dmitri"].push_back("tickets"); items["Anya"].push_back("puppy");
// Iterate over all the items in the container for_each(items.begin(), items.end(), display_item_count); return 0; }
In this example, a "using directive" was used for brevity though in a real-life program, its use should be much more restricted. "Using declarations", which are more specific than directives, are usually recommended :
#include <vector>
int main() { using std::vector;
vector<int> my_vector; return 0; }
Note that the declaration was put at function scope, which reduces chances of clashing (which was the reason for which namespaces were introduced in the language). Dumping whole namespaces in the global namespace, with using directives, defeats the very purpose of namespaces.
Typedefs are used to make the code more concise and to reduce the use of large type names (nobody would like to type something like map<string, vector<string> >::const_iterator each time we need one of those)
Check out more C++ examples.
Objects
C++ introduces some object-oriented (OO) features to C. It offers classes, which provide the four features commonly present in OO (and some non-OO) languages: abstraction, encapsulation, inheritance and polymorphism.
Encapsulation
C++ implements encapsulation by allowing all members of a class to be declared as either public, private, or protected. A public member of the class will be accessible to any function. A private member will only be accessible to functions that are members of that class and to functions and classes explicitly granted access permission by the class ("friends"). A protected member will be accessible to members of classes that inherit from the class in addition to the class itself and any friends.
The OO principle is that all and only the functions that can access the internal representation of a type should be encapsulated within the type definition. C++ supports this (via member functions and friend functions), but does not enforce it: the programmer can declare parts or all of the representation of a type to be public, and is also allowed to make public entities that are not part of the representation of the type. Because of this C++ supports not just OO programming but other weaker decomposition paradigms, like modular programming.
It is generally considered good practice to make all data private, or at least protected, and to make public only those functions that are part of a minimal interface for users of the class that hides implementation details.
Inheritance
Inheritance from a base class may be declared as public, protected, or private. This access specifier determines whether unrelated and derived classes can access the inherited public and protected members of the base class. Only public inheritance corresponds to what is usually meant by "inheritance". The other two forms are much less frequently used. If the access specifier is omitted, inheritance is assumed to be private for a class base and public for a struct base. Base classes may be declared as virtual; this is called virtual inheritance. Virtual inheritance ensures that only one instance of a base class exists in the inheritance graph, avoiding some of the ambiguity problems of multiple inheritance.
Multiple inheritance is another controversial C++ feature. Multiple inheritance allows a class to derive from more than one base class; this can result in a complicated graph of inheritance relationships. For example, a "Flying Cat" class can inherit from both "Cat" and "Flying Mammal". Some other languages, such as Java, accomplish something similar by allowing inheritance of multiple interfaces while restricting the number of base classes to one (interfaces, unlike classes, provide no implementation and no variable data).
Polymorphism
Polymorphism is a widely used and abused term that is not well defined.
In the case of C++ it is often used in connection with member function names, where the function name corresponds to several implementations, and which implementation gets invoked depends either on the type of the arguments (static polymorphism) or on the type of the class instance value (dynamic polymorphism) used on which the virtual member function is invoked.
For example, a C++ program may contain something like this:
// Static polymorphism
extern void SendJobToDevice(PrintJobText*, DeviceLaser*); extern void SendJobToDevice(PrintJobText*, DeviceJet*); extern void SendJobToDevice(PrintJobHTML*, DeviceLaser*); extern void SendJobToDevice(PrintJobHTML*, DeviceJet*); ... SendJobToDevice(printJob, device);
// Dynamic polymorphism
class Device { public: virtual void print(PrintJob*); ... };
PrintJob* printJob; Device* device; ... device->print(printJob); // Note that since C++ does not have multiple dispatch, the above // function call is polymorphic based only on the device's type.
In C, (dynamic) polymorphism of a sort can be achieved using the switch
statement or function pointers.
C++ provides two more sophisticated features for polymorphism: function overloading and virtual member functions. Both features allow a program to define several different implementations of a function for use with different types of objects.
Function overloading allows programs to declare multiple functions with the same name. The functions are distinguished by the number and types of their formal parameters. For example, a program might contain the following three function declarations:
void pageUser(int userid); void pageUser(int userid, string message); void pageUser(string username);
Three different pageUser()
functions are declared. When the compiler afterwards encounters a call to pageUser()
, it determines which function to call based on the number and type of the arguments provided. (The compiler considers only the parameters, not the return type.) Because the compiler determines which function to call at compile time, this is called static polymorphism. (The word static is used here in the sense of "not moving". It denotes that the determination is made based solely on static analysis of the source code: by reading it, not by running it. By the time the program executes, the decision has been made.)
Operator overloading is a form of function overloading. It is one of C++'s most controversial features. Many consider operator overloading to be widely misused, while others think it is a great tool for increasing expressiveness. An operator is one of the symbols defined in the C++ language, such as +
, !=
, <
, or &
. Much as function overloading allows the programmer to define different versions of a function for use with different argument types, operator overloading lets the programmer define different versions of an operator for use with different operand types. For example, if the class Integer
contains a declaration like this:
Integer& operator++();
then the program can use the ++
operator with objects of type Integer
. For example, the code
Integer a = 2; ++a;
behaves exactly like this:
Integer a = 2; a.operator++();
In most cases, this would then increment the value of the variable a to 3. However, the programmer who created the Integer class can define the Integer::operator++()
member function to do whatever he wants. Because operators are commonly used implicitly, it is considered bad style to declare an operator except when its meaning is obvious and unambiguous. Curiously, it can be argued that the standard libraries do not follow this convention. For example, the object cout, used for outputting text to the console, has an overloaded << operator for outputting the text. Critics argue that this use is non-obvious because << is the operator for a bit shift, which is clearly meaningless in this context. Nevertheless, most people consider this use to be acceptable, and this particular example is certainly in C++ to stay.
C++ templates make heavy use of static polymorphism, including overloaded operators.
Virtual member functions provide a different type of polymorphism. In this case, different objects that share a common base class may all support an operation in different ways. For example, a PrintJob
base class might contain a member function
virtual int getPageCount(double pageWidth, double pageHeight)
Each different type of print job, such as DoubleSpacedPrintJob
, may then override the method with a function that can calculate the appropriate number of pages for that type of job. In contrast with function overloading, the parameters for a given member function are always exactly the same number and type. Only the type of the object for which this method is called varies.
When a virtual member function of an object is called, the compiler sometimes doesn't know the type of the object at compile time and therefore can't determine which function to call. The decision is therefore put off until runtime. The compiler generates code to examine the object's type at runtime and determine which function to call. Because this determination is made on the fly, this is called dynamic polymorphism.
The run-time determination and execution of a function is called dynamic dispatch. In C++, this is commonly done using virtual tables.
Resources
Standard library
The 1998 C++ standard consists of two parts: the core language and the C++ standard library; the latter includes most of the Standard Template Library and a slightly modified version of the C standard library. Many C++ libraries exist which are not part of the standard, such as the Boost library. Also, non-standard libraries written in C can generally be used by C++ programs.
The C++ standard library incorporates the C standard library with some small modifications to make it work better with the C++ language. Another large part of the C++ library is based on the Standard Template Library (STL). This provides such useful tools as containers (for example vectors and lists) and iterators (generalized pointers) to provide these containers with array-like access. Furthermore (multi)maps (associative arrays) and (multi)sets are provided, all of which export compatible interfaces. Therefore it is possible, using templates, to write generic algorithms that work with any container or on any sequence defined by iterators. 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.
Using the standard library--for example, using std::vector or std::string instead of a C-style array--can help lead to safer and more scalable software.
The STL (Standard Template Library) was originally a third-party library from HP and later SGI, before its incorporation into the C++ standard. The standard does not refer to it as "STL", as it is merely a part of the standard library, but many people still use that term to distinguish it from the rest of the library (input/output streams [known as IOstreams], internationalization, diagnostics, the C library subset, etc.).
A project known as STLPort, based on the SGI STL, maintains an up-to-date implementation of the STL, IOStreams and strings. Other projects also make variant custom implementations of the standard library with various design goals.
Incompatibility with C
- Additional information can be found on the C programming language article.
While most C source code will compile as C++ code without issue, certain language differences prevent C++ from being a strict superset of C. For example, C++ forbids calling the main
function from within the program, whereas this is legal in C.
In addition, C++ is much stricter about various features; for example, it lacks implicit type conversion between unrelated pointer types and does not allow a function to be used that has not yet been declared.
So, while the following code is valid C:
void somefunc(void *ptr) { int *i = ptr; /* Implicit conversion from void* to int* */ }
The equivalent C++ code would have to be:
void somefunc(void *ptr) { int *i = (int*)ptr; // Explicit cast needed }
A common portability issue from C to C++ are the numerous additional keywords that C++ introduced. This makes C code that uses them as identifiers illegal in C++. For example:
struct template { int new; struct template* class; };
is legal C code, but is rejected by a C++ compiler, since the keywords "template", "new" and "class" are not appropriate in the corresponding places.
The differences even extend to issues of style. For example the old, traditional, way of declaring function arguments in C is not supported at all by C++. The declaration:
int subtract(minuend, subtrahend) int minuend; int subtrahend; { return minuend - subtrahend; }
would be rejected by a C++ compiler which, unlike C, demands that the following, newer, style be used:
int subtract(int minuend, int subtrahend) { return minuend - subtrahend; }
See also
- Aspect-oriented development
- C++ Managed Extensions
- C++/CLI
- C++ struct
- C#
- Circular dependency, how C++ handles circular dependencies
- C string
- Comparison of Java to C++
- Design pattern
- Dev-C++
- GNU Compiler Collection
- Inline function
- Metaprogramming
- Name mangling
- Origins of computer terms
- Object-oriented development
- Objective-C
- OpenC++
- Operators in C and C++
- IBM VisualAge compiler series
- Visual C++
- cppML
- srcML
- Barton-Nackman
References
- . ISBN 0-321-22725-5.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-70431-5.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-470-84674-7.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 1-893115-28-3.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-54855-0.
{{cite book}}
: Cite has empty unknown parameter:|Publisher=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-201-82467-1.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-13-127768-5.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-321-12518-5.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-321-32192-8.
{{cite book}}
: Cite has empty unknown parameter:|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-534-37597-9.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-37927-9.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 1-59059-227-1.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-13-101376-9.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-37926-0.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-42339-1.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-201-70353-X.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-201-63362-0.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-83454-5.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-201-48518-4.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-619-06213-4.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-92488-9.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-63371-X.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0201749629.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-1313-2794-1.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 1-886411-95-6.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-596-00419-2.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-54330-3.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-201-70073-5.
{{cite book}}
: Cite has empty unknown parameter:|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|Edition=
ignored (|edition=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-321-11358-6.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-76042-8.
{{cite book}}
: Cite has empty unknown parameters:|Year=
and|Authorlink=
(help); Missing or empty|title=
(help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-201-73484-2.
{{cite book}}
: Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help); Unknown parameter|Year=
ignored (|year=
suggested) (help) - . ISBN 0-596-00394-3.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-321-22877-4.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help) - . ISBN 0-596-00437-0.
{{cite book}}
: Cite has empty unknown parameter:|Year=
(help); Missing or empty|title=
(help); Unknown parameter|Authorlink=
ignored (|authorlink=
suggested) (help); Unknown parameter|First=
ignored (|first=
suggested) (help); Unknown parameter|Last=
ignored (|last=
suggested) (help); Unknown parameter|Publisher=
ignored (|publisher=
suggested) (help); Unknown parameter|Title=
ignored (|title=
suggested) (help)
External links
Reference material
- Dinkumware's C++ Library Reference Manual
- SGI's Standard Template Library Programmer's Guide
- C/C++ Reference
- Hyperlinked C++ BNF Grammar
Tutorials
- C++ Programming Tutorials Collection
- C++ Programming Tutorial About.com
- TWiki C++ Web gnacademy.org
- The C++ Annotations
- Online C++ Tutorial
- C++ tutorial for C users
- Cplusplus.com tutorial, with complete code examples along with the results from each example shown side by side. Also includes a section on using C++ compilers from different vendors (Microsoft/GNU/Borland) to compile the examples
Books
- C++ Programming Wikibook
- How to Think Like a Computer Scientist C++ version
- Free book "Thinking in C++" by Bruce Eckel
- Free book "C++: A Dialog" by Steve Heller
- Computer-Books.us Collection of online C++ books.
- C++Course The well-known book of A.B. Downey as an HTMLHelp based eBook
Journals
Support
- C++ FAQ Lite by Marshall Cline
- Newsgroups "comp.lang.c++" "comp.lang.c++.moderated" "comp.std.c++"
- C++ learning community, C++ forums
- C++ Forum at Cprogramming.com
- C and C++ at Daniweb
- C++ Home Forum at cpp-home.com
- C++ interview questions at TechInterviews
- Association of C and C++ Users ACCU
Resources
- Internet sites and files of interest to C++ users, A categorised list of C++ related links.
- University of Cambridge Department of Engineering list of C++ links
Libraries and code repositories
- Portable foundation classes from GNU
- Boost.org: C++ high quality libraries
- Common Text Transformation Library
- Planet Source Code with several thousand code samples
- Hierarchical (Mumps) data base facility
Standards
- Standards Committee Page: JTC1/SC22/WG21 - C++
- Somewhat dated draft of the C++ standard
- Testing C++ Compilers for ISO Language Conformance
Compilers
- Borland's freely available compiler (website requires free registration)
- Digital Mars C++
- GNU Compiler Collection, including the g++ compiler
- Microsoft's freely available .NET C++ compiler
- Bloodshed's Dev-C++ compiler
Miscellaneous
- C2.com Discussion
- Parsing C++
- Embedded C++ Homepage
- From Borland C++ to ISO/ANSI C++ A guide to translate C++ code for developers.
- Ch - free interpreter of C++ subset
- C++/CLI by Stanley B. Lippman
- freenode's ##C++ channel wiki
- Article "Incompatibilities Between ISO C and ISO C++" by David R. Tribble
- C++ internals explained via a C++ to C mapping: