Type alignment control
From cppreference.com
The C programming language, as of C11, supports type alignment with the built-in alignment specifier _Alignas and operator _Alignof (see _Alignas and _Alignof). When the header <stdalign.h>
is included, the built-in alignment specifier and operator are also accessible as alignas and alignof.
[edit] Macros
Macro name | Expands to |
alignas
|
_Alignas |
alignof
|
_Alignof |
__alignas_is_defined
|
integer constant 1
|
__alignof_is_defined
|
integer constant 1
|
[edit] Example
Run this code
Possible output:
0x6009f0 0x6009e0 0x6009e1 _Alignof(float[10]) = 4
[edit] See also
C++ documentation for Standard library header <cstdalign>
|