Typed constants and variable alignment

[next] [tail] [up]

#### 8.3.1 Typed constants and variable alignment

All static data (variables and typed constants) which are greater than a byte are usually aligned on a multiple of two boundary. This alignment applies only to the start address of the variables, and not the alignment of fields within structures or objects for example. For more information on structured alignment, section 8.3.2, page 549. The alignment is similar across the different target processors.

Table 8.11: Data alignment

Data size (bytes) | Alignment (small size) | Alignment (fast)
1 | 1 | 1
2-3 | 2 | 2
4-7 | 2 | 4
8+ | 2 | 4

The alignment columns indicates the address alignment of the variable, i.e the start address of the variable will be aligned on that boundary. The small size alignment is valid when the code generated should be optimized for size (-Os compiler option) and not speed, otherwise the fast alignment is used to align the data (this is the default).

[next] [front] [up]