| Autoconf, Automake, and Libtool | ||
|---|---|---|
| <<< Previous | Next >>> | |
My first task in industry was to port a large C++ application from one Unix platform to another. My colleagues immediately offered their sympathies and I remember my initial reaction-`what's the big deal?'. After all, this application used the C++ standard library, a modest subset of common Unix system calls and C++ was approaching ISO standardization. Little did I know what lay ahead--endless hurdles imposed by differences to C++ implementations in use on those platforms.
Being essentially a superset of the C programming language, C++ suffers from all of the machine-level portability issues described in the chapter called Writing Portable C with GNU Autotools. In addition to this, variability in the language and standard libraries present additional trouble when writing portable C++ programs.
There have been comprehensive guides written on C++ portability (see the section called Further Reading). This chapter will attempt to draw attention to the less portable areas of the C++ language and describe how the GNU Autotools can help you overcome these (see the section called How GNU Autotools Can Help). In many instances, the best approach to multi-platform C++ portability is to simply re-express your programs using more widely supported language constructs. Fortunately, this book has been written at a time when the C++ language standard has been ratified and C++ implementations are rapidly conforming. Gladly, as time goes on the necessity for this chapter will diminish.
C++ was developed in 1983 by Bjarne Stroustrup at AT&T. Stroustrup was seeking a new object-oriented language with which to write simulations. C++ has now become a mainstream systems programming language and is increasingly being used to implement free software packages. C++ underwent a lengthy standardization process and was ratified as an ISO standard in 1998.
The first specification of C++ was available in a book titled `The Annotated C++ Reference Manual' by Stroustrup and Ellis, also known as the `ARM'. Since this initial specification, C++ has developed in some areas. These developments will be discussed in the section called Changeable C++.
The first C++ compiler, known as cfront, was produced by Stroustrup at AT&T. Because of its strong ties to C and because C is such a general purpose systems language, cfront consisted of a translator from C++ to C. After translation, an existing C compiler was used to compile the intermediate C code down to machine code for almost any machine you care to mention. C++ permits overloaded functions--that is, functions with the same name but different argument lists, so cfront implemented a name mangling algorithm (see the section called Name Mangling) to give each function a unique name in the linker's symbol table.
In 1989, the first true C++ compiler, G++, was written by Michael Tiemann of Cygnus Support. G++ mostly consisted of a new front-end to the GCC portable compiler, so G++ was able to produce code for most of the targets that GCC already supported.
In the years following, a number of new C++ compilers were produced. Unfortunately many were unable to keep pace with the development of the language being undertaken by the standards committee. This divergence of implementations is the fundamental cause of non-portable C++ programs.
| <<< Previous | Home | Next >>> |
| Unix/Windows Portability | Changeable C++ |