🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15690

Re: Structure and sizeof mis-behaving

#15690
From: Hans Galema
Date: Mon, 16 Jun 2003 11:18
16 lines
1600 bytes
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: <3eeda780$3@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-mail
References: <3eed33f3$1@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 04:28:14 PST
Date: Mon, 16 Jun 2003 13:18:37 +0200
From: Hans Galema <j.m.galema.dontusethis@maartens.nl>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3.1) Gecko/20030425
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Structure and sizeof mis-behaving
References: <3eed33f3$1@newsgroups.borland.com>
In-Reply-To: <3eed33f3$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.108.11
Message-ID: <3eeda780$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1055762304 129.125.108.11 (16 Jun 2003 04:18:24 -0700)
Lines: 17
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