|
|
|
|
|
by Just_Harry
535 days ago
|
|
> I don’t understand why these extra paddings are present and why one is gone. Even with pragma pack 8, should not it be only one padding? If you're referring to `__pad2` in the example, that trailing padding is there to ensure that the size of the struct is a multiple of its alignment, which is 8, so that if there's a contiguous span of those structures, each instance after the first one will remained properly aligned.
Without `__pad2`, that struct would be 36-bytes, which would cause every other instance in an array/contiguous-span to be aligned on 4 bytes instead of 8. |
|