S
simonp
I'm taking an intro course on C++, and our teacher is not being
clear on how stuct memory padding is determined.
If the memory used by all components defined inside a struct
falls between a certain gradient, a struct "rounds up" to the
nearest multiple of the gradient.
This teacher is somewhat erratic and has said on subsequent days
that first the padding is rounded up to nearest multiple of 4,
and then the nearest power of 2.
I reading on my own, it looks like the padding of the struct is
determined by the word size fo the platform, which I assume means
multiples of 16.
Could someone well-versed in C++ please point out how this is
done?
Cheers,
Simon
clear on how stuct memory padding is determined.
If the memory used by all components defined inside a struct
falls between a certain gradient, a struct "rounds up" to the
nearest multiple of the gradient.
This teacher is somewhat erratic and has said on subsequent days
that first the padding is rounded up to nearest multiple of 4,
and then the nearest power of 2.
I reading on my own, it looks like the padding of the struct is
determined by the word size fo the platform, which I assume means
multiples of 16.
Could someone well-versed in C++ please point out how this is
done?
Cheers,
Simon