Mail Archives: djgpp/1996/04/07/15:24:45
Alignment. Do:
#pragma pack(1)
struct ... {
... __attribute__((packed));
... -ditto-
};
#pragma pack()
Mike <mbwarren AT acs DOT ucalgary DOT ca> wrote:
>what am i doing wrong:
>with djgpp v2, when i take the sizeof this struct:
>typedef struct
>{
> char magic[2];
> long size;
> int dummy;
> long offset;
>} header_t;
>it returns 16, when it should return 14 (2 chars = 2 + long (4) + int (4)
>+ lont (4) = 2+4+4+4=14)
>(BTW, why are int's represented as 4 bytes on a PC? sizeof(int) returns
>4...)
>i am using djgpp v2 on a 486-33 w/4megs ram...
>(if this is in the FAQ, sorry, but i can't use www/ftp; our DNS server is
>down...)
>------------. mailto:mbwarren AT acs DOT ucalgary DOT ca .--------------
>.___ ___. | o _ | ? |"a smoking
>| \/ | | /\, (*) '\o__ o | section in a
>| i K E | | .(*)>(*)______'(*)\_____./'\.|\_________. | resturant is
>| | | | Gateway to the TEMPLE OF MIKE +---+ | like a peeing
>|__|\/|__| | `-.----------------------------------.--' | | section in a
>w a r r e n | | http://www.ucalgary.ca/~mbwarren +------+ | swimming pool"
>------------' `----------------------------------' '\.____________
- Raw text -