Mail Archives: djgpp-workers/2004/05/02/11:15:43
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 -