Software Optimization Guide for AMD64 Processors

25112 Rev. 3.06 September 2005

2.22Array Indices

Optimization

The preferred type for array indices is ptrdiff_t.

Application

This optimization applies to:

32-bit software

64-bit software

Rationale

Array indices are often used with pointers while doing arithmetic. Using ptrdiff_t produces more portable code and will generally provide good performance.

46

C and C++ Source-Level Optimizations

Chapter 2

Page 62
Image 62
AMD 250 manual Array Indices