Date: Thu, 21 Oct 1999 16:59:05 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Fabrice LETE cc: djgpp AT delorie DOT com Subject: Re: structure size rounded to int size? In-Reply-To: <380F12E1.74D9DE4@umh.ac.be> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 21 Oct 1999, Fabrice LETE wrote: > If I have: > > typedef struct FOO { > short a; long b; > }; > > sizeof(FOO) give me 8... > > What can I do to avoid the problem This is not a problem, this is due to alignment done by the compiler to make the code faster. See section 22.10 of the DJGPP FAQ list for more about this. > (I guess it's a switch to use with the compiler...)? There is a switch, but after you read the FAQ, you will see why it is not recommended to use, except in some specific situations.