Subject: Re: FW: Re: wxwin port
From: [email-masked] (Scott Blachowicz)

11 Nov 1996 18:08:18 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
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 <[email-masked]>
Original-Cc: Wayne Meissner <[email-masked]>, [email-masked]
In-Reply-To: Your message of "Sun, 10 Nov 1996 14:49:07."
             <[email-masked]> 
Original-Sender: [email-masked]

Keith Gary Boyce <[email-masked]> 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
[email-masked]                        Seattle, WA USA   98109
[email-masked]

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".