Say I need to allocate struct A
but b
needs to be 4 aligned.
struct A{ char a; char b[42];};
I guess I can manually pad a pointer returned by malloc()
. Any cleaner way? Like gcc's __attribute__((aligned(4)))
but that aligns the whole structure. And I can't change it's layout.