3 ms·
Hmm, I don't understand (sorry). The pointer to the internal array must be aligned. But how does the element size play into the padding. If we take these two ex
by alkonaut 10y ago
Hmm, I don't understand (sorry). The pointer to the internal array must be aligned. But how does the element size play into the padding. If we take these two examples?
[repr(C)]
struct StructA
{
pub foo: f32,
_alignment: [SixteenBytes, 0]
}
[repr(C)]
struct StructB
{
pub foo: f32,
_alignment: [ThirtytwoBytes, 0]
}
Are both just padded with 16-4 and 32-4 bytes respectively, so they are equivalent to making a padding like this in the first case?
[repr(C)]
struct StructAPadded
{
pub foo: f32,
_padding : TwelveBytes;
}