JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris 64-bit Developer's Guide
search filter icon
search icon

Document Information

Preface

1.  64-bit Computing

2.  When to Use 64-bit

3.  Comparing 32-bit Interfaces and 64-bit Interfaces

4.  Converting Applications

Data Model

Implementing Single-Source Code

Feature Test Macros

Derived Types

<sys/types.h> File

<inttypes.h> File

Fixed-Width Integer Types

uintptr_t and Other Helpful Types

Constant Macros

Limits Defined by <inttypes.h>

Format String Macros

Tools Support

lint for 32-bit and 64-bit Environments

Guidelines for Converting to LP64

Do Not Assume int and Pointers Are the Same Size

Do Not Assume int and long Are the Same Size

Sign Extension

Use Pointer Arithmetic Instead of Address Arithmetic

Repacking a Structure

Check Unions

Specify Constant Types

Beware of Implicit Declaration

sizeof is an unsigned long

Use Casts to Show Your Intentions

Check Format String Conversion Operation

Other Considerations

Derived Types That Have Grown in Size

Check for Side Effects of Changes

Check Whether Literal Uses of long Still Make Sense

Use #ifdef for Explicit 32-bit Versus 64-bit Prototypes

Algorithmic Changes

Checklist for Getting Started

Sample Program

5.  The Development Environment

6.  Advanced Topics

A.  Changes in Derived Types

B.  Frequently Asked Questions (FAQs)

Index

Chapter 4

Converting Applications

Two basic issues that regard conversion arise for applications developers:

Trying to maintain a single source with as few #ifdefs as possible is usually better than trying to maintain multiple source trees. This chapter provides guidelines for writing code that works correctly in both 32-bit environments and 64-bit environments. At best, the conversion of current code might require only a recompilation and relinking with the 64-bit libraries. However, for those cases where code changes are required, this chapter discusses the tools that help make conversion easier.