C plus plus

From GPWiki
Jump to: navigation, search

Note: The correct name of this page is C++; however, due to technical restrictions it is represented as C_plus_plus instead.

History & About

The C++ programming language was created in the early 1980s by Bjarne Stroustrup at the Bell Laboratories. In his own words: C++ was designed primarily so that my friends and I would not have to program in assembler, C, or various modern high-level languages. Its main purpose was to make writing good programs easier and more pleasant for the individual programmer (Bjarne Stroustrup, The C++ Programming Language).

C++ is inspired by languages like C, Simula, Algol, Ada, Clu, ML. The main reason was not to impose new styles or paradigms, but just reuse anything that could be useful and pleasant to programmers. Stroustrup also chose to create C++ as a superset of the C programming language to be able to use the wealth of libraries and routines which were available to C, however over time C++ has evolved and can no longer be called a pure superset of C. There are a good number of incompatibilities where valid C code is not valid C++, though these issues are easy to avoid. Generally they result from either the new reserved words in C++ ( such as new and delete ) or from C++'s increased type-safety ( for example, C++ needs a cast to assign a void* value to a T* variable ).

In 1998 the ISO standard that defined the language was approved (ISO/IEC 14882:1998). In 2003 a small "fix" was published (ISO/IEC 14882:2003), that clarified some points in the standard. A revision of the standard, with changes in the language and in the standard library, is planned for 2009.

C and C++ relationship

Although it is possible to compile C code with a C++ compiler, there are important differences between the two languages, which make it impossible to compile all standard C code with a standard C++ compiler. Also, the main differences aren't in the syntax, but the way the code is organized. Most C programmers initiating in C++ tend to start feeding C code to the C++ compiler, and get no advantage at all from the C++ language over the C language. That's why Stroustrup suggests that it's a good idea to learn C++ directly - otherwise the programmer may need to unlearn coding pratices typical in C and/or in Java, that are bad style in C++.

Stroustrup has suggested that the incompatibilities between the two languages should be reduced as much as possible, to be able to take advantage of the two languages' interoperability.



Don't have a C or C++ development environment? See C:Development_Environments for information on the various free and commercial development environments available for your platform. Learning C++? See C:Online Resources for a list of useful online resources.


Tutorials and Source Code

For tutorials on C++, click here: View C++ Tutorials.

Community Help

GUITutorial info.gifStill need help? Ask on the forums and see what we can do. C and C++ Programming Forum