From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Bytes and words Date: Sun, 08 Feb 1998 22:42:50 +0100 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 39 Message-ID: <34DE26DA.B50A1030@LSTM.Ruhr-UNI-Bochum.De> References: <34DD3806 DOT 92C44AF4 AT ea DOT oac DOT uci DOT edu> <34DD4AF1 DOT E35F1A26 AT bethany DOT edu> NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de 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 Precedence: bulk pneyz wrote: > > > If I try to include this in a simple program, gcc complains about the > > use of semicolons in a structure and (it seems) about the use of > > 'BYTE'. Is the above just meant to be a very formal looking piece of > > pseudocode, or can one actually declare bytes and words (2 bytes?) in > > this manner? > > BYTE and WORD are not defined be default, so most coders put something > like: > > typedef unsigned char byte; > typedef unsigned int word; > > In their code for gfx routines. However, in DJGPP, an int is 4 bytes by > default, so you should change the int to a short. byte and word are not > C identifiers, but are holdovers from asm (I think). Additionally you may have to put a #pragma pack(1) before and a #pragma pack() after the struct definition, because otherwise gcc will align struct members to d(?)word boundaries. I am pretty, but not completely, sure that a TGA header is packed with no spare space between members. -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************