From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: How to align members/data under gcc/DJGPP? Date: Thu, 27 Jun 2002 18:28:53 +0100 Lines: 30 Message-ID: <3D1B4B55.A1E5E31B@phekda.freeserve.co.uk> References: <96eb2770 DOT 0206270530 DOT 3d2253dc AT posting DOT google DOT com> <3d1b37f1$1 AT news DOT infonet DOT ee> NNTP-Posting-Host: modem-120.arkansas.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg4.svr.pol.co.uk 1025200536 20409 62.137.55.120 (27 Jun 2002 17:55:36 GMT) NNTP-Posting-Date: 27 Jun 2002 17:55:36 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello. Tonu Aas wrote: > > > I can't find in FAQ (sorry, maybe I missed it), how to align struct > > members under gcc/DJGPP? What is pragma/option doing this? > > I use header files for that: > > struct aligned_struct > { > char a_default; > #include "align4.h" > char a_4; > #include "popalign.h" > char aa_default; > } > > Works well with several compilers so far... (also gcc) [snip] __attribute__ should be preferred over #pragma, when using gcc. See the end of this info page for the reasons: info gcc 'c extensions' 'function attributes' Regards, -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]