Mail Archives: djgpp/2001/06/18/08:53:14
Lunar wrote:
>
> I've read the FAQ. It says if I add an "-fpack-struct" command line option,
> GCC will not align the struct. But in fact, when I try that, sizeof() still
> report 4 bytes as it did before.
> Can you help, please?
With some versions of gcc (including recent DJGPP packages), you can use
a
MSVC-like pragma:
#pragma pack(push, 1)
struct mystruct {
char mychar;
short myshort;
} mystructvar;
#pragma pack(pop)
This is a bit cleaner than having to append an __attribute__ tag to
each field.
--
Tim Van Holder - Anubex N.V.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This message was posted using plain text. I do not endorse any
products or services that may be hyperlinked to this message.
- Raw text -