This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc structures
- From: Andrew Haley <aph at redhat dot com>
- To: David Brown <david at westcontrol dot com>
- Cc: JimJoyce <jim at jimjoyce dot co dot uk>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 09 Sep 2013 10:56:59 +0100
- Subject: Re: gcc structures
- Authentication-results: sourceware.org; auth=none
- References: <1378635037939-966595 dot post at n5 dot nabble dot com> <CAH6eHdT3OBqj+cqpn-jHkTvctCs451AOVVH=CYO-Cq=S5UgkpQ at mail dot gmail dot com> <CAL0hcBWkqtqXVEgR_CMnoNHMdqMAXpqqXcagicS3qG09jMr06w at mail dot gmail dot com> <522D8D5F dot 2070106 at westcontrol dot com>
On 09/09/2013 09:57 AM, David Brown wrote:
> I'm not even sure if it is
> required to keep the struct elements in the same order
It is. 6.7.2.1:
Each non-bit-field member of a structure or union object is
aligned in an implementation-defined manner appropriate to its
type. Within a structure object, the non-bit-field members and the
units in which bit-fields reside have addresses that increase in
the order in which they are declared.
Andrew.