JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: C User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction to the C Compiler

2.  C-Compiler Implementation-Specific Information

3.  Parallelizing C Code

4.  lint Source Code Checker

5.  Type-Based Alias Analysis

6.  Transitioning to ISO C

7.  Converting Applications for a 64-Bit Environment

7.1 Overview of the Data Model Differences

7.2 Implementing Single Source Code

7.2.1 Derived Types

7.2.1.1 <sys/types.h>

7.2.1.2 <inttypes.h>

Fixed-Width Integer Types

Helpful Types Such as unintptr_t

Constant Macros

Limits

Format String Macros

7.2.2 Tools

7.2.2.1 lint

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.3 Sign Extension

7.3.4 Pointer Arithmetic Instead of Integers

7.3.5 Structures

7.3.6 Unions

7.3.7 Type Constants

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 Considerations

7.4.1 Derived Types That Have Grown in Size

7.4.2 Check for Side Effects of Changes

7.4.3 Check Whether 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

7.4.6 Algorithm Changes

7.5 Checklist for Getting Started

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

D.  Supported Features of C99

E.  Implementation-Defined ISO/IEC C90 Behavior

F.  ISO C Data Representations

G.  Performance Tuning

H.  The Differences Between K&R Solaris Studio C and Solaris Studio ISO C

Index

Chapter 7

Converting Applications for a 64-Bit Environment

This chapter provides the information you need for writing code for the 32 bit or the 64-bit compilation environment.

Once you try to write or modify code for both the 32-bit and 64-bit compilation environments, you face two basic issues:

Maintaining a single code-source with as few #ifdefs as possible is usually better than maintaining multiple source trees. Therefore, this chapter provides guidelines for writing code that works correctly in both 32-bit and 64-bit compilation environments. In some cases, the conversion of current code requires only a recompilation and relinking with the 64-bit libraries. However, for those cases where code changes are required, this chapter discusses the tools and strategies that make conversion easier.