Article View: borland.public.cppbuilder.nativeapi
Article #15702Re: Structure and sizeof mis-behaving
From: Chris
Date: Mon, 16 Jun 2003 17:18
Date: Mon, 16 Jun 2003 17:18
23 lines
1676 bytes
1676 bytes
This did not work. :(
"Hans Galema" <j.m.galema.dontusethis@maartens.nl> wrote in message
news:3eeda780$3@newsgroups.borland.com...
> Chris wrote:
> > CBuilder6 is reporting the size of BITMAPFILEHEADER two bytes bigger
than it
> > actually is, and there are two extra junk bytes at the beginning of the
> > structure data that shouldn't be there. They aren't there in CBuilder5,
and
> > the size is reported properly, too.
>
> This is because of aligning of the variables at 4 byte boundaries.
>
> Try:
>
> #pragma push(pack, 2) // set to 2 byte alignment
> > typedef struct tag2BITMAPFILEHEADER {
> > ....
> #pragma push(pop) // reset to previous alignment value
>
> Hans.
>
Technical Details
Message-ID:
<3eedfbf5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3eed33f3$1@newsgroups.borland.com> <3eeda780$3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,316b0e1c5551c37a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-16 10:27:33 PST From: "Chris" <Chris8852@adelphia.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <3eed33f3$1@newsgroups.borland.com> <3eeda780$3@newsgroups.borland.com> Subject: Re: Structure and sizeof mis-behaving Date: Mon, 16 Jun 2003 13:18:47 -0400 Lines: 25 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.65.164.124 Message-ID: <3eedfbf5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1055783925 68.65.164.124 (16 Jun 2003 10:18:45 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail