www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/12/07:49:06

Message-ID: <E1FF8239A075D311AF7200A0C9D60AE30A7067@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: bmp->screen function
Date: Tue, 12 Oct 1999 11:17:46 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

Klaus Reinhardt writes:
> Trying to understand the bmp-file-format I found in bmp.c(allegro) 
>the following; perhaps a non-effective error - but why does the 
>type of bfType isn't unsigned short?
>                     ^^^^^^^^^^^^^^
>
>typedef struct BITMAPFILEHEADER
>{
>   unsigned long  bfType;

The size of fields in the structure doesn't matter, since they
are only ever read and written as individual values, so they
don't have to match up with the format of the file on disk.
It is actually a really bad idea to ever write code that does
require that kind of match, because that leaves you open to
all sorts of nasty problems with compilers doing structure
padding behind your back, different type sizes and endianess
on different platforms, etc.


	Shawn Hargreaves.

- Raw text -


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