Mail Archives: djgpp/1999/10/12/07:49:06
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 -