7.1 Overview of the Data Model Differences

The biggest difference between the 32-bit and the 64-bit compilation environments is the
change in data-type models.

The C data-type model for 32-bit applications is the ILP32 model, so named
because integers, longs, and pointers are 32-bit data types. The LP64 data model,
so named because longs and pointers grow to 64-bits, is the creation of
a consortium of companies across the industry. The remaining C types, int,
longlong, short, and char, are the same in both data-type models.

The following table lists the basic C data types and their corresponding sizes
in bits for both the ILP32 and LP64 data models.

Table 7-1 Data Type Size for ILP32 and LP64

C Data Type

ILP32

LP64

char

8

8

short

16

16

int

32

32

long

32

64

longlong

64

64

pointer

32

64

enum

32

32

float

32

32

double

64

64

longdouble

128

128

current 32-bit applications typically assume that integers, pointers, and longs are the same
size. However, the size of longs and pointers changes in the LP64 data
model, which can cause many ILP32 to LP64 conversion problems.

In addition, declarations and casts are very important. How expressions are evaluated can
be affected when the types change. The effects of standard C conversion rules
are influenced by the change in data-type sizes. To adequately show what you
intend, you need to explicitly declare the types of constants. You can also
use casts in expressions to make certain that the expression is evaluated the
way you intend. This practice is particularly important with sign extension, where explicit
casting is essential for demonstrating intent.