Portability and Standards

You've written a handy C++ program for the elderly 286 PC AT computer at work when management decides to replace the machine with a Sun workstation, a computer using a different processor and a different operating system. Can you run your program on the new platform? Of course, you'll have to recompile the program using a C++ compiler designed for the new platform. But will you have to make any changes to the code you wrote? If you can recompile the program without making changes and it runs without a hitch, we say the program is portable.

There are a couple of obstacles to portability, the first of which is hardware. A program that is hardware-specific is not likely to be portable. One that takes direct control of an ...

Get C++ Primer Plus, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.