C++ Migration Guide

The C++ Language

C++ was first described in The C++ Programming Language (1986) by Bjarne Stroustrup, and later more formally in The Annotated C++ Reference Manual (the ARM) (1990), by Margaret Ellis and Bjarne Stroustrup. The Sun C++ 4 compiler versions were based primarily on the definition in the ARM, with additions from the then-emerging C++ standard. The additions selected for inclusion in C++ 4, and particularly in the C++ 4.2 compiler, were mainly those that did not cause source and binary incompatibility.

C++ is now the subject of an international standard, ISO/IEC 14882:1998 Programming Languages - C++. The C++ 5.0 compiler in standard mode implements nearly all of the language as specified in the standard. The README file that accompanies the current release describes any departures from requirements in the standard.

Some changes in the C++ language definition prevent compilation of old source code without minor changes. The most obvious example is that the entire C++ standard library is defined in namespace std. The traditional first C++ program


#include <iostream.h>
int main() { cout << "Hello, world!" << endl; }

no longer compiles under a strictly-conforming compiler because the standard name of the header is now <iostream> (without the .h), and the names cout and endl are in namespace std, not in the global namespace. The C++ 5.0 compiler, as an extension, provides a header <iostream.h> that allows that program to compile even in standard mode. Besides the source code changes required, such language changes create binary incompatibilities, and so were not introduced into the Sun C++ compiler prior to version 5.0.

Some newer C++ language features also required changes in the binary representation of programs. This subject is discussed in some detail in "Binary Compatibility Issues".