Struct definition as following(on 32-bit Linux):
#pragma pack(push, 8)
struct MY_STRUCT
{
char a[2];
short b;
short c;
short d;
int e;
long long x;
long long y;
};
#pragma(pop)
During the test, result of 'sizeof(struct MY_STRUCT)' is 28. Why not 32?
As I had expected, a,b,c,d will be packed into one 8-byte, e one and x, y
two. Ain't I right?
If I get wrong usage of #pragma pack(), could anyone please tell me how to
get it work correctly?
BTW, what on earth is the difference between __attribute__ align() and
#pragma pack()?
Thanks in advance!