Datasheet
ARM Compiler Reference
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 3-23
3.3.2 Basic data types
This section gives information about how the basic data types are implemented in ARM
C and C++.
Size and alignment of basic data types
Table 3-3 gives the size and natural alignment of the basic data types. Type alignment
varies according to the context. (See Structures, unions, enumerations, and bitfields on
page 3-26.)
• Local variables are usually kept in registers, but when local variables are spilled
onto the stack, they are always word-aligned. For example, a spilled local
char
variable has an alignment of 4.
• The natural alignment of a packed type is 1.
Integer
Integers are represented in two's complement form. The low word of a
long long
is at
the low address in little-endian mode, and at the high address in big-endian mode.
Table 3-3 Size and alignment of data types
Type Size in bits Natural alignment in bytes
char
8 1 (byte-aligned)
short
16 2 (halfword-aligned)
int
32 4 (word-aligned)
long
32 4 (word-aligned)
long long
64 4 (word-aligned)
float
32 4 (word-aligned)
double
64 4 (word-aligned)
long
double
64 4 (word-aligned)
All pointers 32 4 (word-aligned)
bool
(C++ only) 32 4 (word-aligned)