Mail Archives: djgpp/1993/10/04/22:32:10
Is it possible to pack a struct, so that it uses the least amount of memory
required for the data.
example:
struct {
uchar reg;
uchar *scr;
uchar r,g,b;
} RGB;
Normally sizeof(RGB)==12. Is it possible to tell the compiler NOT to pad out
structs to multiple-of-4 sizes. I understand that in the above example,
swapping reg and scr would result in a sizeof()==8 (which is what I want),
but when you are working with file headers that are not of your own design,
you can not simply reorder your struct.
Thank you,
Erik R Johnson
- Raw text -