- I have some type
Tthat I explicitly specify as x-aligned - x >
sizeof(T) - x > any implementation fundamental alignment
- (ex: x is page or cache aligned)
Suppose I now have: T arr[y], where arr is x-aligned (either by being allocated on the stack, or in data, or by an x-aligned heap allocation)
Then at least some of arr[1],...,arr[y-1] are not x-aligned.
Correct? (In fact, it must be correct if sizeof(T) does not change with extended alignment specification)
Note1: This is not the same question as How is an array aligned in C++ compared to a type contained?. This question asks about the alignment of the array itself, not of the individual elements inside.
Note2: This question: Does alignas affect the value of sizeof? is essentially what I'm asking - but for extended-alignment.
Note3: https://stackoverflow.com/a/4638295/7226419 Is an authoritative answer to the question (that sizeof(T) includes any padding necessary to satisfy alignment requirements for having all T's in an array of T's properly aligned.