This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Alignment of Variables


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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]