|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Studio 12.3: C User's Guide Oracle Solaris Studio 12.3 Information Library|
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, long long, short, and char, are the same in both data-type models.
Regardless of the data-type model, the standard relationship between C integral types holds true:
sizeof (char) <= sizeof (short) <= sizeof (int) <= sizeof (long)
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
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.