On Jul 8, 2008, at 19:40, Tom Yu via RT wrote:
Show quoted text
> On most platforms, the memcpy() should work because the structure
> layouts are identical for their initial overlapping elements. (The C
> standard does not guarantee this.) On the Mac, the use of "#pragma
> pack" could cause a difference in structure layout.
>
> We need to investigate whether this constitutes an ABI change on the
> Mac. Given that a caller can receive a new structure type-punned to
> the old one, I believe it is an ABI change.
Yes, I believe it is as well. I think the only way to avoid that is a
Mac-specific "#pragma pack" for the extended version of the structure
too. It will have no effect on other platforms, and the only Mac code
it could break would be code trying to explicitly set one field after
the extended structure has been put into use, and somehow relying on
the fact that it *doesn't* set the intended field, but overwrites
something else. I won't lose any sleep over breaking such programs. :)
Ken