www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/23/23:42:24

Date: Sun, 23 Feb 1997 21:28:33 -0700 (MST)
From: David May <dmay AT tvi DOT cc DOT nm DOT us>
To: Delong <dandelong AT osha DOT igs DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Help: My structure members aren't getting the right offsets!
In-Reply-To: <3310E089.78F9@osha.igs.net>
Message-ID: <Pine.SOL.3.95.970223212130.20350B-100000@curie.tvi.cc.nm.us>
MIME-Version: 1.0

On Sun, 23 Feb 1997, Delong wrote:

> I am trying to get the VBE implementation to return a VBEInfoBlock, and
> VBEInfoBlock is supposed to be 512 bytes long, but the structure I
> defined after the VBE 2.0 specs to have 512 bytes (I counted them) is
> turning out to be 516 bytes long!
> 

The FAQ explains this (I'm not at a DOS box now so I can't grep it to tell
you where.  Anyway, structures are padded by DJGPP for performance
reasons.  This is typically not a problem because it is done so
consistently.  However, there are times when structres are used to access
files that are of a particular format (like dBASE III files) and these are
not padded the way DJGPP would.  There are a few solutions here.  The one
I use (which some on this list have said is "evil" - sorry  :) is to use a
#pragma pack(1) before the declaration of the structure you want packed.
The FAQ gives other solutions to this problem.

Hope this helps.

David May
ID Card Adminstrator
Albuquerque TVI


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019