Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Studio 12.3: C User's Guide Oracle Solaris Studio 12.3 Information Library |
1. Introduction to the C Compiler
2. C-Compiler Implementation-Specific Information
7. Converting Applications for a 64-Bit Environment
7.1 Overview of the Data Model Differences
7.2 Implementing Single Source Code
Helpful Types Such as unintptr_t
7.3 Converting to the LP64 Data Type Model
7.3.1 Integer and Pointer Size Change
7.3.2 Integer and Long Size Change
7.3.4 Pointer Arithmetic Instead of Integers
7.3.8 Beware of Implicit Declarations
7.3.9 sizeof( ) Is an Unsigned long
7.3.10 Use Casts to Show Your Intentions
7.3.11 Check Format String Conversion Operation
7.4 Other Conversion Considerations
7.4.1 Note: Derived Types That Have Grown in Size
7.4.2 Check for Side Effects of Changes
7.4.3 Check Literal Uses of long Still Make Sense
7.4.4 Use #ifdef for Explicit 32-bit Versus 64-bit Prototypes
7.4.5 Calling Convention Changes
8. cscope: Interactively Examining a C Program
A. Compiler Options Grouped by Functionality
B. C Compiler Options Reference
C. Implementation-Defined ISO/IEC C99 Behavior
E. Implementation-Defined ISO/IEC C90 Behavior
H. Oracle Solaris Studio C: Differences Between K&R C and ISO C
Use the following checklist to help you convert your code to 64-bit.
Review all data structures and interfaces to verify that these are still valid in the 64-bit environment.
Include <inttypes.h> in your code to provide the _ILP32 or _LP64 definitions as well as many basic derived types. For systems programs, include <sys/types.h> (or at a minimum, <sys/isa_defs.h>) to obtain the definitions of _ILP32 or _LP64.
Move function prototypes and external declarations with non-local scope to headers and include these headers in your code.
Run lint using the -m64 and -errchk=longptr64 and signext options. Review each warning individually. Keep in mind that not all warnings require a change to the code. Depending on the changes, run lint again in both 32-bit and 64-bit modes.
Compile code as both 32-bit and 64-bit unless the application is being provided only as 64-bit.
Test the application by executing the 32-bit version on the 32-bit operating system, and the 64-bit version on the 64-bit operating system. You can also test the 32-bit version on the 64-bit operating system.