delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/04/15/07:14:57.1

From: Thomas DOT Irlet AT x400 DOT gr DOT admin DOT ch
Subject: Alignment of Variables
15 Apr 1998 07:14:57 -0700 :
Message-ID: <00A877F500000002*.cygnus.gnu-win32@MHS>
To: gnu-win32 AT cygnus DOT com

I am using EGCS V1.0 with the MINGW32 Headers. Now I have a problem wi
th the alignment of variables in the structure "BITMAPFILEHEADER". The
 structure is defined as
 
typedef struct tagBITMAPFILEHEADER {
 WORD     bfType;
 DWORD  bfSize;
 WORD     bfReserved1;
 WORD     bfReserved2;
 DWORD  bfOffBits;
} BITMAPFILEHEADER;
 
My problem was now, that the compiler aligns all variables to their na
tural boundaries, that is WORD to wordbouderies, DWORD to longbounderi
es. To achieve this, a dummy WORD is inserted after bfType. To read in
 a BMP-file, this scrambles the whole header.
What can I do to prevent the compiler to "optimize" this structures. A
re there any "PRAGMA"'s, that could be used. A compilerswitch is not s
o preferable, because in this case, very structure stays unoptimized.
 
Thanks for any tip
                            Thomas Irlet
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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