X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Message-ID: <409508C6.1000002@phekda.gotadsl.co.uk> Date: Sun, 02 May 2004 15:42:14 +0100 From: Richard Dawe User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031031 X-Accept-Language: en, de, fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: pragma pack in dir.h References: <8011-Sat01May2004205607+0300-eliz AT gnu DOT org> In-Reply-To: <8011-Sat01May2004205607+0300-eliz@gnu.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli Zaretskii wrote: > This one cost me a few hours of debugging. > > has this: > > /* This is for g++ 2.7.2 and below */ > #pragma pack(1) > > struct ffblk { > char lfn_magic[6] __attribute__((packed)); /* LFN */ > short lfn_handle __attribute__((packed)); /* LFN */ > unsigned short lfn_ctime __attribute__((packed)); /* LFN */ > unsigned short lfn_cdate __attribute__((packed)); /* LFN */ > unsigned short lfn_atime __attribute__((packed)); /* LFN */ > ... > > and later it does this: > > #pragma pack(4) > > I suppose #pragma pack(4) was meant to return to the default struct > padding, but, at least with GCC 3.3.3, it doesn't. [snip] > Alternatively, we could use "#pragma pack(0)", as this is documented > to reset the packing to the default, but I'm afraid that old versions > of GCC might not support that (otherwise, why didn't we use pack(0) in > the first place?). [snip] How about switching from a pragma to using __attribute__((packed))? Bye, Rich =] -- Richard Dawe [ http://homepages.nildram.co.uk/~phekda/richdawe/ ] "You can't evaluate a man by logic alone." -- McCoy, "I, Mudd", Star Trek