structure members of packed structures

Nathan Sidwell nathan@codesourcery.com
Mon Jul 14 17:23:00 GMT 2003


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




More information about the Gcc mailing list