Mail Archives: djgpp/1996/09/30/20:57:23
John Panettiere wrote:
>
> Hello, all.
>
> 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?
Only if you are using C++, in which case there is a bug in the gcc
compiler that prevents the __attribute__((packed)) keyword from
working. The workaround is to surround the struct definition with
#pragma pack(1)
...
#pragma pack()
BTW, this is in the FAQ, section 22.10.
--
John M. Aldrich <fighteer AT cs DOT com>
* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
again.
* It doesn't necessarily do it in chronological order, though.
--- Douglas Adams
- Raw text -