delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/02/01:16:04

Mime-Version: 1.0
To: WT <gnatwt AT mailexcite DOT com>, djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: Problem with integer declaration?
Date: Fri, 1 May 1998 22:10:27 -0700
Message-ID: <19980502051013.AAF531@ppp122.cartsys.com>

At 11:07  5/1/1998 -0700, 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. I am
>sure my struct is correct because I've checked it many times. This is
>how the struct is declared :
[snipped]
>Could it be something wrong with the int declaration? Please help!

It's from the fact that GCC aligns struct members. This is a feature. FAQ
section 22.9 talks about this indirectly, and has pointers to the sections
of the GCC docs which say how to fix it.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


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