Xref: news2.mv.net comp.os.msdos.djgpp:3678 From: Roland Exler Newsgroups: comp.os.msdos.djgpp Subject: Re: more sizeof questions Date: Fri, 10 May 1996 07:50:57 -0700 Organization: Institute for el. Measurement, University of Linz, Austria Lines: 34 Message-ID: <319357D1.9FD@jk.uni-linz.ac.at> References: <199605090048 DOT UAA09442 AT eelab DOT newpaltz DOT edu> NNTP-Posting-Host: sensor4.emt.uni-linz.ac.at Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp John Fortin wrote: > typedef unsigned char BYTE; > typedef unsigned short WORD; > typedef unsigned long DWORD; > > typedef struct > { > DWORD VESASignature; 4 > WORD VESAVersion; 2 > DWORD OEMStringPointer; 4 > DWORD Capabilities; 4 > DWORD VideoModePointer; 4 > WORD TotalMemory; 2 > BYTE Info[236]; 236 > } _VGAInfoBlock; = 256 bytes > > John E. Fortin > fortin44 AT eelab DOT newpaltz DOT edu Each element of the structure will be aligned, so 2 bytes will be padded after VESAVersion and 2 after TotalMemory which gives 260 instead of 256! Try __attribute__ ((packed)) or #pragma pack(1) as some previous posts has shown. Roland +---------------------------------------+---------------------------+ I Roland Exler I EMAIL: I I Universitaet Linz I R DOT Exler AT jk DOT uni-linz DOT ac DOT at I I Institut fuer Elektrische Messtechnik I I I Altenbergerstr. 69 I Phone: I I A-4040 Linz, AUSTRIA I + 43 732 2468 9205 I +---------------------------------------+---------------------------+