delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/03/05:35:37

From: tom burgess <tburgess AT drao DOT nrc DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with integer declaration?
Date: Sun, 03 May 1998 02:26:38 -0700
Organization: BCTEL Advanced Communications
Lines: 16
Message-ID: <354C384E.6F40@drao.nrc.ca>
References: <354AB827 DOT 8EE19C9D AT mailexcite DOT com>
NNTP-Posting-Host: pntn02m03-192.bctel.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

The problem is that the default alignment for structure members is
32 bits for efficiency. Shorts get padded to 32 bits, hence you have
4 extra bytes because you have 2 shorts in your struct. The "packed"
attribute should prevent this, but at the moment I don't recall the
correct usage. Try djgpp info. I seem to recall that there may be a
bug with "packed" - you could check the delorie archives to get the
details.

	regards, tom

WT wrote:
> 
> I am trying to write a short program to detect VESA VBE and output
> information about the video card. I declared a struct of 512 bytes to be
> used as a buffer for vbe_info_block. The strange thing is that when I
> printed sizeof(vbe_info_block) it gave me 516 bytes instead of 512.

- Raw text -


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