HP C Programmer's Guide (92434-90009)

Chapter 5 153
Programming for Portability
Porting between HP C and VMS C
_ _hpux and _ _unix on all systems
HP-UX preprocessors do not include white space in the replacement text of a macro.
The VMS preprocessor does include the trailing white space. If your HP C program
depends on the inclusion of the white space, you can place white space around the
macro invocation.
Compiler Environment
In VMS, files with a suffix of .C are assumed to be C source files, .OBJ suffixes imply
object files, and .EXE suffixes imply executable files. HP-UX uses the normal
conventions on UNIX that .c implies a C source file, .o implies an object file, and a.out
is the default executable file (but there is no other convention for executable files).
varargs is supported on VMS and all HP-UX implementations. See vprintf(3S) and
varargs(5) for a description and examples.
curses is supported on VMS and all HP-UX implementations. See curses(3X) for a
description.
VMS supports VAXC$ERRNO and errno as two system variables to return error
conditions. HP-UX supports errno although there may be differences in the error codes
or conditions.
VMS supplies getchar and putchar as functions only, not as macros. HP-UX supplies
them as macros and also supplies the functions fgetc and fputc which are the function
versions.
Major differences exist between the file systems of the two operating systems. One of
these is that the VMS directory SYS$LIBRARY contains many standard definition files
for macros. The HP-UX directory /usr/include has a rough correspondence but the
contents differ greatly.
A VMS user must explicitly link the RTL libraries SYS$LIBRARY:VAXCURSE.OLB,
SYS$LIBRARY:VAXCRTLG.OLB or SYS$LIBRARY:VAXCRTL.OLB to perform C input/output
operations. The HP-UX input/output utilities are included in /lib/libc, which is
linked automatically by cc without being specified by the user.
Certain standard functions may have different interfaces on the two systems. For
example, strcpy() copies one string to another but the resulting destination may not
be NULL terminated on VMS whereas it always will be on HP-UX.
The commonly used HP-UX names end, edata and etext are not available on VMS.