Sender: tim AT picard DOT skynet DOT be Message-ID: <3B2DF9C2.75AF6AA6@falconsoft.be> Date: Mon, 18 Jun 2001 14:53:22 +0200 From: Tim Van Holder Organization: Anubex N.V. X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.4-win4lin i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 To: djgpp AT delorie DOT com CC: lunarorb AT hn DOT vnn DOT vn Subject: Re: BIG problem with structure alignment! References: <000e01c0f7eb$4e4fc600$910fa2cb AT lunar> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com 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.