X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Kbwms AT aol DOT com Message-ID: <15b.33f0137d.2dc673ae@aol.com> Date: Sun, 2 May 2004 11:54:22 EDT Subject: Re: pragma pack in dir.h To: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part1_15b.33f0137d.2dc673ae_boundary" X-Mailer: 8.0 for Windows sub 6021 Reply-To: djgpp-workers AT delorie DOT com --part1_15b.33f0137d.2dc673ae_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In a message dated 5/2/2004 9:44:05 AM Eastern Standard Time, eliz AT gnu DOT org writes: > >So, what works now for GCC 3.3.3? I'm using dir.h in an ancient program > >written circa 1999 and the program uses #pragma pack(1) with the comment /* > Kill > >pragmas from dir.h */. > > "#pragma pack(1)" is certainly _not_ correct if it is used after > dir.h. Its effect is to cause GCC to pack all structs, i.e. it > defeats the normal struc member padding meant to make member access > aligned according to the member data width. > > However, if that program has only one source file, and there are no > struct definitions in system header files included after dir.h, you > will not see any adverse effects (except, perhaps, some slowdown) in > that particular program. > > But for better results, you should use "#pragma pack(0)" (or patch > your dir.h). > > >Where is pragma pack(0) documented? > > Unfortunately, it isn't. The GCC manual doesn't document pragma pack > (or i386-specific pragmas in general). > > I simply guessed that pack(0) should reset the padding to its default > state, but couldn't be sure until I googled for this and found a few > messages posted to GCC-related forums which explained that this indeed > is the case. > Terrific, Eli. Thank you. --part1_15b.33f0137d.2dc673ae_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable In a message dated 5/2/2004 9:44:05 A= M Eastern Standard Time, eliz AT gnu DOT org writes:

>So, what works now for GCC= 3.3.3?  I'm using dir.h in an ancient program
>written circa 1999 and the program uses #pragma pack(1) with the comment= /* Kill
>pragmas from dir.h */.

"#pragma pack(1)" is certainly _not_ correct if it is used after
dir.h.  Its effect is to cause GCC to pack all structs, i.e. it
defeats the normal struc member padding meant to make member access
aligned according to the member data width.

However, if that program has only one source file, and there are no
struct definitions in system header files included after dir.h, you
will not see any adverse effects (except, perhaps, some slowdown) in
that particular program.

But for better results, you should use "#pragma pack(0)" (or patch
your dir.h).

>Where is pragma pack(0) documented?

Unfortunately, it isn't.  The GCC manual doesn't document pragma pack (or i386-specific pragmas in general).

I simply guessed that pack(0) should reset the padding to its default
state, but couldn't be sure until I googled for this and found a few
messages posted to GCC-related forums which explained that this indeed
is the case.

<= BR> Terrific, Eli.  Thank you. --part1_15b.33f0137d.2dc673ae_boundary--