Re: Unnecessary struct padding
Re: Unnecessary struct padding
- Subject: Re: Unnecessary struct padding
- From: Sean McBride <email@hidden>
- Date: Mon, 22 Aug 2011 18:25:09 -0400
- Organization: Rogue Research Inc.
On Mon, 22 Aug 2011 18:15:44 -0400, Benjamin Rister said:
>Am I forgetting some rule about alignment or something that makes this
>padding legitimate or needed? My first choice would not be to disable
>the compiler’s padding altogether, because while it all lines up now, I
>don’t want to accidentally break it later without noticing—and if I’m
>forgetting a reason why this would be needed, just disabling it already
>could break something. Any suggestions?
The C language does not guarantee any particular padding, and thus the compiler may pad as it sees fit. The ABI may, and does, require certain padding, and thus the compiler will conform to that, but different ABIs (ex: in 32 vs 64 bit) pad things differently.
In short, if you need things padding in a specific way, you need to use something like #pragma pack(1).
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden