Installation guide
(varargs.h) mechanism. See varargs(3) for more information on the use
of these macros.
Programs written using varargs that expect the va_list type to be a
pointer, or that make assumptions about the stack layout of a routine’s
arguments, are nonportable. Such programs must be modified to correctly
use the varargs
(3) mechanism. Failure to do so will give compile-time
errors, or incorrect run-time results.
See varargs
(3) for more information.
7.3.5 Library Calls
The 64-bit data types also affect the following library calls:
• printf and scanf functions
• malloc and calloc functions
• lseek system call
• fsetpos and fgetpos functions
The following sections describe how these functions are affected.
7.3.5.1 The printf and scanf Functions
When using the printf function for long types, you use the length
modifier l (lowercase letter L) with the d, u, o, and x conversion characters
to specify assignment of type long or unsigned long. For example, when
printing a long as a signed decimal, use %ld instead of %d. When printing
a long as a unsigned decimal, use %lu instead of %u. If the length modifier
is not used, the type is assumed to be int,orunsigned int, depending
upon the conversion character. In this case, the long types will be
converted to the smaller int types and information might be lost.
When printing a pointer, use %p. If you want to print the pointer as a
specific representation, the pointer should be cast to an appropriate integer
type long before using the desired format specifier. For example, to print a
pointer as a long unsigned decimal number, use %lu:
char *p;
printf ( "%p %lu\n", (void *)p, (long)p );
As a rule, to print an integer of arbitrary size, cast the integer to long or
unsigned long, and use the %ld ( unsigned long) conversion character.
For example:
printf ("%ld\n", (long) num ));
Migrating Your ULTRIX Application to a DIGITAL UNIX System 7–19