Installation guide

7.3.4 Variables
The 64-bit DIGITAL UNIX environment also changes assumptions about
how you declare your variables, and how you use them in assignments and
in function arguments.
7.3.4.1 Declarations
To enable your application to work on both 32-bit and 64-bit systems, check
your int and long declarations. If you have specific variables that need to
be 32 bits in size on both ULTRIX MIPS and Alpha systems, define the
type to be int. If the variable should be 32 bits on ULTRIX MIPS systems
and 64 bits on Alpha systems, define the variable to be long. Remember, if
the type specifier is missing from a declaration, it defaults to int type. For
example, here are six declarations that declare the variables to be of size
int and the function to be returning type int:
extern e;
register n;
static x;
unsigned i;
const c;
function ();
7.3.4.2 Assignments and Function Arguments
Since pointer, int, and long are no longer the same size in the 64-bit
DIGITAL UNIX environment, problems may arise depending on how the
variables are assigned and used in your application. Use the following
guidelines:
Do not use int and long interchangeably because of the possible
truncation of significant digits. For example, avoid assignments similar
to the following:
int i;
long l;
i=l;
Use the lint Q command to help you find these potential problems.
See Section 7.5 and lint
(1) for more information on the lint command.
Do not pass arguments of type long to functions expecting type int.
For example, avoid assignments similar to the following:
int toascii(int);
int i;
long l;
i= toascii(l)
7–16 Migrating Your ULTRIX Application to a DIGITAL UNIX System