Compatibility of C and C++

C++ began as a fork of an early, pre-standardized C, and was designed to be mostly source-and-link compatible with C compilers of the time.

Bjarne Stroustrup, the creator of C++, has suggested[4] that the incompatibilities between C and C++ should be reduced as much as possible in order to maximize interoperability between the two languages.

On the other hand, C99 reduced some other incompatibilities compared with C89 by incorporating C++ features such as // comments and mixed declarations and code.

While C and C++ maintain a large degree of source compatibility, the object files their respective compilers produce can have important differences that manifest themselves when intermixing C and C++ code.

[22] For example, the following code: Using Sun Microsystems' C++ compiler, this produces the following warning: This is because my_function() is not declared with C linkage and calling conventions, but is being passed to the C function foo().