Xref: news2.mv.net comp.os.msdos.djgpp:2520 From: avly AT castle DOT net (An) Newsgroups: comp.os.msdos.djgpp Subject: Re: SIZEOF disparity...? Date: Sun, 07 Apr 1996 04:05:15 GMT Organization: The Castle Network, Internet Accounts 908 548-8881. Lines: 49 Message-ID: <4k7f2a$ld7@arther.castle.net> References: Reply-To: avly AT castle DOT net NNTP-Posting-Host: bridge51.castle.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Alignment. Do: #pragma pack(1) struct ... { ... __attribute__((packed)); ... -ditto- }; #pragma pack() Mike 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" >------------' `----------------------------------' '\.____________