This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

structure members of packed structures


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]