Mail Archives: djgpp/1998/04/18/13:59:44
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
- Raw text -