C 89/99
C was essentially the core language of C++ when Bjarne Stroustrup, decided to create a "better C". Many of the syntax conventions and rules still hold true and so we can even state that C was a subset of C++, most recent C++ compilers will also compile C code taking into consideration the small incompatibilities, since C99 and C++ 2003 are not compatible any more. You can also check more information about the C language on the C Programming Wikibook ( http://en.wikibooks.org/wiki/C_Programming ).
C++ as defined by the ANSI standard in 98 (called C++98 at times) is very nearly, but not quite, a superset of the C language as it was defined by its first ANSI standard in 1989 (known as C89). There are a number of ways in which C++ is not a strict superset, in the sense that not all valid C89 programs are valid C++ programs, but the process of converting C code to valid C++ code is fairly trivial (avoiding reserved words, getting around the stricter C++ type checking with casts, declaring every called function, and so on).
In 1999, C was revised and many new features were added to it. As of 2004, most of these new "C99" features are not there in C++. Some (including Stroustrup himself) have argued that the changes brought about in C99 have a philosophy distinct from what C++98 adds to C89, and hence these C99 changes are directed towards increasing incompatibility between C and C++.
The merging of the languages seems a dead issue as coordinated actions by the C and C++ standards committees leading to a practical result didn't happen and it can be said that the languages started even to diverge.
Some of the differences are:
- C++ supports function overloading (absent in C89, allowed only for some standard library code in C99).
- C++ supports inheritance and polymorphism.
- C++ adds keyword class, but keeps struct from C, with compatible semantics.
- C++ supports access control for class members.
- C++ supports generic programming through the use of templates.
- C++ extends the C89 standard library with its own standard library.
- C++ and C99 offer different complex number facilities.
- C++ has bool and wchar_t as primitive types, while typedefs in C.
- C++ comparison operators return bool, while C returns int.
- C++ supports overloading of operators.
- C++ character constants have type char, while C character constants have type int.
- C++ has additional cast operators (static_cast, dynamic_cast, const_cast and reinterpret_cast).
- C++ adds mutable keyword to address the imperfect match between physical and logical constness.
- C++ extends the type system with references.
- C++ supports member functions, constructors and destructors for user-defined types to establish invariants and to manage resources.
- C++ supports runtime type identification (RTTI), via typeid and dynamic_cast.
- C++ includes exception handling.
- C++ has std::vector as part of its standard library instead of variable-length arrays as in C.
- C++ treats sizeof operator as compile time operation, while C allows it be a runtime operation.
- C++ has new and delete operators, while C uses malloc and free library functions exclusively.
- C++ supports object-oriented programming without extensions.
- C++ does not require use of macros and careful information-hiding and abstraction for code portability.
