HPlogo HP C/HP-UX Programmer's Guide: HP 9000 Computers

Chapter 5 Programming for Portability

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Portable C programs are clear, reliable, and easily maintainable and can be easily transported from one machine to another. With few modifications, C programs written with portability in mind can be recompiled and run on different computers. For specific information on system dependencies, refer to the HP C/HP-UX Reference Manual.

The ANSI standard specifies which aspects of C are required to work the same on conforming implementations, and which can work differently. Since many ANSI-conforming compilers are available on a wide variety of platforms, it is easy to develop portable programs. HP C, when invoked in ANSI mode and used with the preprocessor (cpp), headers, libraries, and linker, conforms fully with the standard.

This chapter discusses some guidelines for making your C programs more portable. Emphasis is placed on HP C specific portability issues, especially as they relate to porting from pre-ANSI mode HP C (Kernighan and Ritchie plus BSD extensions) to ANSI mode HP C.

© Hewlett-Packard Development Company, L.P.