data_alignment
Syntax
#pragma data_alignment=expressionParameters
| A constant which must be a power of two (1, 2, 4, etc.). |
Description
Use this pragma directive to give the immediately following variable a higher (more strict) alignment of the start address than it would otherwise have. This directive can be used on variables with static and automatic storage duration.
When you use this directive on variables with automatic storage duration, there is an upper limit on the allowed alignment for each function, determined by the calling convention used.
Note
Normally, the size of a variable is a multiple of its alignment. The data_alignment directive only affects the alignment of the variable’s start address, and not its size, and can therefore be used for creating situations where the size is not a multiple of the alignment.
Note
To comply with the ISO C11 standard and later, it is recommended to use the alignment specifier _Alignas for C code. To comply with the C++11 standard and later, it is recommended to use the alignment specifier alignas for C++ code.