On 06 Mar 2015, at 02:50, Jens Alfke wrote:
Shouldn’t C alignment rules dictate that the ‘value’ union and the surrounding ‘atomic_val_t’ type be 8-byte-aligned, since they contain a 64-bit integer?
Alignment rules are not dictated by the programming language, but by the ABI. The ARM ABI, and also Apple's variant, says that 64 bit integers are only guaranteed 4 byte alignment: https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html
And if they don’t, what’s the workaround to ensure safe alignment?
Here's how to do it in gcc (aligned attribute), maybe it works the same in clang: https://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html
Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to [email protected]
