HP C Programmer's Guide (92434-90009)

Chapter 6 163
Migrating C Programs to HP-UX
Library Functions
Library Functions
The set of library routines available on HP-UX systems may differ from those available on
BSD 4.2 systems. If you encounter an unresolved function after linking, refer to the
HP-UX Reference Manual to see if there is an HP-UX function that does what you want it
to do. If not, you will have to write one of your own.
Floating-Point Format
The VAX floating-point representation is different from that on HP 9000 computers. You
will have to change any programs dependent on the characteristics of VAX floating point.
In particular, this difference could expose errors in the code that happen to work
acceptably on the VAX. These errors include mismatched function return types (float on
one side, double on the other), and passing the address of a double instead of a float to
scanf. The VAX representation of a float differs in the number of bits in the exponent, as
well as the mantissa. Therefore, mismatched types can cause a vastly different answer on
HP 9000 computers.
Bit-Fields
The HP 9000 Series 700/800 C compiler treats bit-fields without the unsigned type
modifier as signed. The VAX, HP 9000 Series 300/400, and 500 compilers treat them as
unsigned
Data Storage and Alignment
The alignment requirements of some data types are different on the HP 9000 Series
700/800. Check any externally imposed data structure layouts for differences. These may
include byte and bit-field order, if you are migrating from a VAX, or different internal
padding for structure member alignment. On the HP 9000 Series 700/800, doubles must
be aligned on a 64-bit boundary, whereas other machines require alignment on a 32-bit
boundary. Refer to Chapter 2 for complete storage and alignment information.