www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/07/05:42:07

Date: Sun, 7 Apr 1996 12:32:36 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mike <mbwarren AT acs DOT ucalgary DOT ca>
Cc: djgpp AT delorie DOT com
Subject: Re: SIZEOF disparity...?
In-Reply-To: <Pine.A32.3.92.960406153743.75628A-100000@acs5.acs.ucalgary.ca>
Message-Id: <Pine.SUN.3.91.960407122651.22664C-100000@is>
Mime-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019