Note: data alignment is described in detail in this article . If you want to know what the term as a whole means and why this is an important issue, read the article.
Aligment is defined in C ++ as an integer value defined by the implementation, representing the number of bytes between consecutive addresses where this object can be allocated [6.11. 1] Alignment .
In addition, alignments must be non-negative integer powers of 2 [6.11.4] Alignment .
When we calculate the alignment of the structure, we must take into account one more rule [6.11.5] Alignment :
Alignments range from weaker to stronger or more rigorous alignments. Stricter alignments have higher alignment values. an address that satisfies the alignment requirement also satisfies any weaker correct alignment requirements.
It is not explicitly stated, but these rules imply that the alignment of the structure should be at least strictly the same as the alignment of its most strictly aligned element . It may be more, but it is not necessary, and usually it is not.
So, when the alignment of the structure from the OP example is decided, the alignment of the structure should be no less than the alignment of its only char[16] element type char[16] . Then 8.3.6 [expr.alignof] :
If alignment is applied to the reference type, the result is alignment of the reference type. When alignof is applied to the type array, the result is the alignment of the element type .
alignof(char[16]) is equal to alignof(char) , which will usually be 1 due to [6.11.6] Alignment :
(...) narrow character types should have the weakest alignment requirement.
In this example:
struct Foo { char c[16]; double d; };
double has lowercase alignment than char , so alignof(Foo) is equal to alignof(double) .