4.32 Compiler storage of data objects by natural byte alignment

C data types are aligned on specific byte boundaries, depending on their type.

By default, the compiler stores data objects by byte alignment as shown in the following table.

Table 4-9 Compiler storage of data objects by byte alignment

Type Bytes Alignment
char, bool, _Bool 1 Located at any byte address.
short, wchar_t 2 Located at any address that is evenly divisible by 2.
float, int, long, pointer
4 Located at an address that is evenly divisible by 4.
long long, double, long double
8 Located at an address that is evenly divisible by 8.
Related concepts
4.30 Types of data alignment
4.31 Advantages of natural data alignment
4.34 Unaligned data access in C and C++ code
4.35 The __packed qualifier and unaligned data access in C and C++ code
Related reference
4.33 Relevance of natural data alignment at compile time
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.