www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/05/02/11:15:43

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 <rich AT phekda DOT gotadsl DOT co DOT uk>
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>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> This one cost me a few hours of debugging.
> 
> <dir.h> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019