I've been told:

[ABIs] guarantee the exact layout of the struct, byte offset of every member, which bits are used for bit fields, where and how much padding there is, etc...

But I've always believed that padding and alignment were unspecified and unreliable.

Does the Itanium ABI (which GCC uses) in fact specify these things (as far as I can tell, it doesn't appear to beyond specifying ranges)?

And if it does, how do options like __attribute__ ((packed)) fit into that? Do they ultimately break the ABI by altering the alignment of things?

Or, as the quotee implies, is packing merely unspecified between toolchains but in fact reliable and predictable within the use of a certain ABI? And then, again, how does something like __attribute__ ((packed)) fit into that?

Edit
Report