delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/21/13:26:19

Date: Thu, 21 Oct 1999 16:59:05 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Fabrice LETE <et980139 AT umh DOT ac DOT be>
cc: djgpp AT delorie DOT com
Subject: Re: structure size rounded to int size?
In-Reply-To: <380F12E1.74D9DE4@umh.ac.be>
Message-ID: <Pine.SUN.3.91.991021165705.4001B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019