From: scott AT statsci DOT com (Scott Blachowicz) Subject: Re: FW: Re: wxwin port 11 Nov 1996 18:08:18 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: References: Reply-To: scott AT statsci DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: exmh version 1.6.9 8/22/96 Original-To: Keith Gary Boyce Original-Cc: Wayne Meissner , gnu-win32 AT cygnus DOT com In-Reply-To: Your message of "Sun, 10 Nov 1996 14:49:07." Original-Sender: owner-gnu-win32 AT cygnus DOT com Keith Gary Boyce 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".