delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/09/06:20:18

Date: Tue, 9 May 2000 11:38:42 +0200 (MET DST)
From: pad2369 <pad2369 AT iperbole DOT bologna DOT it>
Message-Id: <200005090938.LAA11639@maggiore.iperbole.bologna.it>
To: djgpp AT delorie DOT com, Jared Stevens <stevja AT lineo DOT com>
References: <00050815311200 DOT 09858 AT sparky DOT lineo DOT com>
In-Reply-To: <00050815311200.09858@sparky.lineo.com>
MIME-Version: 1.0
User-Agent: IMP/PHP3 Imap webMail Program 2.0.11
Sender: pad2369 AT iperbole DOT bologna DOT it
Subject: Re: Datatype sizes
Reply-To: djgpp AT delorie DOT com

Jared Stevens <stevja AT lineo DOT com>:
> Hello -
> In DJGPP, since it's a 32-bit compiler, when I make a 
> variable of type
> char,
> does it store that variable in a 32-bit slot in 
> memory, or an 8-bit slot? I
> heard somewhere that when you make a variable if it 
> is smaller than 32
> bits, it
> will store it in a 32 bit slot. If it does do this, 
> is there a way to make
> it
> store a char in an 8-bit slot and an int in a 16 bit 
> slot?

AFAIK It is possible to use the minimal storage only
when dealing with fields in struct's. You can use
the "#pragma pack(1)" directive or use 
"__attribute((packed))__" when declaring such structs.

Look at FAQ 22.11 for more details on this topic.

BTW, be warned that since gcc is a 32 bit compiler the
size of an integer is not 16 bit, but 32. If you need
16 bit integers you have to use "short int".

ciao
  Giacomo
------------------------------------------------------
Giacomo Degli Esposti - pad2369 AT iperbole DOT bologna DOT it

- Raw text -


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