Mail Archives: cygwin/1996/11/11/18:08:18
Keith Gary Boyce <garp AT opustel DOT com> wrote:
> Will someone give me an answer in context....
> How do I get sizeof(BITMAPFILEHEADER) to be 14 when structure is
> as follows and with gnu-win32 sizeof(BITMAPFILEHEADER) is 16 when it
> should be 14?? Help would be greatly appreciated.
>
> (gdb) ptype BITMAPFILEHEADER
> type = struct tagBITMAPFILEHEADER {
> short unsigned int bfType;
> unsigned int bfSize;
> short unsigned int bfReserved1;
> short unsigned int bfReserved2;
> unsigned int bfOffBits;
> }
I would place my bets on there being an extra 2 bytes of alignment padding
between the bfType and bfSize fields. The alignment of the fields probably
wants to stick the 4 byte bfSize field on an offset into the struct that is a
multiple of 4 bytes.
One way to see what's going would be to do some variant of these untested
little debugging statements:
#define offset(str,field) (&(str.field) - &(str))
struct tagBITMAPFILEHEADER tag;
printf ("offset of bfType=%d\n", offset(tag, bfType));
printf ("offset of bfSize=%d\n", offset(tag, bfSize));
printf ("offset of bfReserved1=%d\n", offset(tag, bfReserved1));
Scott Blachowicz Ph: 206/283-8802x240 Mathsoft (Data Analysis Products Div)
1700 Westlake Ave N #500
scott AT statsci DOT com Seattle, WA USA 98109
Scott DOT Blachowicz AT seaslug DOT org
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -