Message-Id: <199609302355.QAA05114@bluesky.com> Comments: Authenticated sender is From: "Kevin Baca" To: djgpp AT delorie DOT com Date: Mon, 30 Sep 1996 16:58:43 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: packed data structures? > > At first I didn't know why my VBE2 code wasn't working, but then I > > realized that djgpp wasn't packing the data structures - so I browsed > > the info files and found "__attribute__((packed))", which seemed to be > > the answer I was looking for. I applied this attribute to every field > > in all of my VBE2 data structures, but the problem still seemed to > > remain - 16 bit fields were being padded! Is there a known problem > > with packing, or is there something I'm overlooking? > > Are you sure you have defined the structures correctly? I do this > exactly as you have stated, and have no problem at all with it. How > are you defining your 16 bit fields? You should be using short int's... > :) > There are bugs with GCC packing. For example, under GCC 2.7.2 the __attribute__((packed)) directive doesn't work in C++ code. Try this instead: #pragma pack(1) typedef struct { short foo; short bar; } foobar; #pragma pack() This seems to work in both C and C++. -Kevin