On 2011-05-16 18:04, Davi Arnaut wrote:
> My concern is about alignment of the subsequent elements of the array.
> I think we can rely on the compiler to add padding after the last
> member to ensure that each element in a array of the type is aligned.
aha. I did some investigations:
long long i;
sizeof(foo) will typically be 16, i.e. include the necessary padding, in
case we want to
have an array of foos, and do pointer arithmetic or array indexing.
So effectively there is no padding "between elements" of an array,
rather the padding is within each struct.
I also found this quote somewhere:
[220.127.116.11] When applied to a class, the result [of the sizeof()
operator] is the number of bytes in an object of that class including
any padding required for placing objects of that type in an array.