Mail Archives: djgpp/1998/02/11/12:46:15
Jason Alexander wrote:
> typedef struct _TgaHeader
> {
> BYTE IDLength;
> BYTE ColorMapType;
> BYTE ImageType;
> WORD CMapStart;
> WORD CMapLength;
> BYTE CMapDepth;
> BYTE XOffSet;
> WORD YOffSet;
> WORD Width;
> WORD Height;
> BYTE PixelDepth;
> BYTE ImageDescriptor
> } TGAHEAD;
>
> 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?
It's meant to be pseudocode.
It's also a pretty stupid thing to put in a book, since there is no way
in standard C to guarantee that all structure members are unpadded
(e.g., that there is no unused space between the members). In gcc/DJGPP
you do this with the use of the __attribute__ keyword; see C extensions
in the info pages.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm://+37.20.07/-121.53.38
\
"Life may be / the product of imperfections."
/ (Marclo Gleiser)
- Raw text -