This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
structure members of packed structures
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 14 Jul 2003 16:58:18 +0100
- Subject: structure members of packed structures
- Organization: Codesourcery LLC
Given,
struct Unpacked { int i; };
struct __attribute__ ((packed)) Packed
{
char c;
Unpacked u;
};
where should 'u' be placed? Our current behavour is to pack it so that
Unpacked's members are unaligned.
options
1) continue this behaviour, but prevent taking references/address of u or
any of its members.
2) force u to be aligned (ignoring the packed attribute).
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk