16. Writing Portable C++ with GNU Autotools
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
15. 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 section 16.5 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 section 16.4 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.