X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Sun, 02 May 2004 16:42:10 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp-workers AT delorie DOT com Message-Id: <6480-Sun02May2004164210+0300-eliz@gnu.org> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <97.475c058b.2dc55089@aol.com> (Kbwms@aol.com) Subject: Re: pragma pack in dir.h References: <97 DOT 475c058b DOT 2dc55089 AT aol DOT com> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Kbwms AT aol DOT com > Date: Sat, 1 May 2004 15:12:09 EDT > > 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.