Porting from 32-bit to 64-bit mode

IBM® XL C/C++ for Linux, V16.1 supports only 64-bit compilation mode, which means you can use the XL C/C++ compiler to develop only 64-bit applications.

You might want to port existing 32-bit applications to the 64-bit IBM XL C/C++ for Linux, V16.1. However, this can lead to a number of problems, mostly related to the differences in C/C++ long and pointer data type sizes and alignment between the two modes. The following table summarizes these differences.
Table 1. Size and alignment of data types in 32-bit and 64-bit modes
Data type 32-bit mode 64-bit mode
Size Alignment Size Alignment
long, signed long, unsigned long 4 bytes 4-byte boundaries 8 bytes 8-byte boundaries
pointer 4 bytes 4-byte boundaries 8 bytes 8-byte boundaries
size_t (defined in the header file <cstddef>) 4 bytes 4-byte boundaries 8 bytes 8-byte boundaries
ptrdiff_t (defined in the header file <cstddef>) 4 bytes 4-byte boundaries 8 bytes 8-byte boundaries
The following sections discuss some of the common pitfalls implied by these differences, as well as recommended programming practices to help you avoid most of these issues:

For suggestions on improving performance in 64-bit mode, see Optimize operations in 64-bit mode.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us