HP C Programmer's Guide (92434-90009)

148 Chapter5
Programming for Portability
Porting between HP C and Domain/C
Porting between HP C and Domain/C
All HP-UX and Domain computers have ANSI C compilers. Strictly standard-compliant
programs are highly portable between all these architectures.
The following Domain/C extensions are not supported on HP-UX in compatibility mode
and in most cases, are not supported in ANSI mode either:
Reference variables.
The following preprocessor directives: #attribute, #options, #section, #module,
#debug, #eject, #list, #nolist, and #systype.
std_$call.
attribute modifier and options specifier.
systype predefined macro.
_BFMTCOFF predefined macro.
_ISPM68K predefined macro.
_ISPA88K predefined macro.
_ISPPA_RISC predefined macro.
Partial specification of struct and union members.
Function prototypes, struct and union initialization, and the predefined names and , all
of which are ANSI C features, are supported on HP-UX in ANSI mode.
Compile line options are different between HP-UX C and Domain/C. Check the respective
cc(1) page for complete descriptions.
There are other differences between HP-UX C and Domain/C:
Alignment: All Domain workstations have hardware or software assists to handle
misaligned data. Programs that rely on these features will not run on the Series 800.
Floating-point exceptions: All Domain workstations, by default, enable invalid
operation, divide by zero, and overflow exception traps. Programs that rely on fault
detection, for instance, to enter a fault handler or to terminate execution on
encountering a fault, will ordinarily generate useless output on HP-UX. However, the
PA1.1 math library for the Series 700/800 provides a function fpsetdefaults(3M),
which enables these traps and therefore allows such programs to run as expected. For
more information, see the HP-UX Floating-Point Guide.
struct layout and alignment, especially bit-field, is different.
float data type: Domain/C optimizes a statement all of whose atoms are float or
floating-point constants, to be evaluated in float rather than double.
register declarations: Domain/C completely ignores register declarations, except to
ensure that language constraints are not violated.
Include file search rules are different.