Date: Sun, 7 Apr 1996 12:32:36 +0200 (IST) From: Eli Zaretskii To: Mike Cc: djgpp AT delorie DOT com Subject: Re: SIZEOF disparity...? In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sat, 6 Apr 1996, Mike wrote: > what am i doing wrong: > > with djgpp v2, when i take the sizeof this struct: [snip] > it returns 16, when it should return 14 (2 chars = 2 + long (4) + int (4) > + lont (4) = 2+4+4+4=14) DJGPP pads structs to make all its fields to be properly aligned, so that acessing them will be the fastest. For more details see section 22.9 of the DJGPP FAQ list. > (BTW, why are int's represented as 4 bytes on a PC? sizeof(int) returns > 4...) Because DJGPP is a 32-bit compiler which produces 32-bit code, whereby an int gets 32 bits. > (if this is in the FAQ, sorry, but i can't use www/ftp; our DNS server is > down...) You don't need WWW. Download the file v2/faq200b.zip from the same place you get DJGPP and you will have the FAQ (in 3 different formats!) at your fingertips.