Date: Sat, 18 Apr 1998 10:55:50 -0700 (PDT) From: Nate Eldredge To: Jasper van Woudenberg

cc: djgpp AT delorie DOT com Subject: Re: Struct optimizing by compiler In-Reply-To: <01bd6ad8$16320920$151601bf@cb001687> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 18 Apr 1998, Jasper van Woudenberg wrote: > Hi, > > When i try to define a structure, it seems that the compiler sometimes > optimizes the variables to start at a 'long' address. for example: > > struct X { short X, // (can) reserve 4 bytes for X, to get Y at > a 'long' address > long Y, > short Z }; > > Sometimes interrupt routines return pointers to data structures in memory, > and when i copy that data into a structure like the above, the data is > corrupted, because X uses 4 bytes in stead of 2 bytes. How can i make the > compiler _always_ reserve 2 bytes for a short, 4 bytes for a long, etc.? See FAQ sections 22.9 and 22.10. Nate Eldredge nate AT cartsys DOT com