[cfe-dev] __attribute__((packed, aligned(4)))?
Tim Northover
t.p.northover at gmail.com
Sun Jun 30 10:38:15 PDT 2013
Hi,
Does anyone have a good model for how the "packed" and "aligned"
attributes interact?
For example:
struct Foo __attribute__((packed, aligned(4))) {
int a;
char b;
int c;
};
struct Foo var;
It seems that alignof(var) == 4, but alignof(var.a) == 1. This is
surprising to me.
Is this just a GCC quirk that we've had to emulate or is there a good
reason for it?
Cheers.
Tim.
More information about the cfe-dev
mailing list