delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/09/07:29:10

Date: Tue, 9 May 2000 12:19:08 +0200 (MET DST)
From: pad2369 <pad2369 AT iperbole DOT bologna DOT it>
Message-Id: <200005091019.MAA17313@maggiore.iperbole.bologna.it>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp AT delorie DOT com
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000509120427 DOT 946M-100000 AT is>
In-Reply-To: <Pine.SUN.3.91.1000509120427.946M-100000@is>
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

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>:
> > 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?
>
> A `char' takes a single byte.
 
I am not an expert about gcc internals, so I sould say 
something silly here: do you mean that this function 
allocates only two bytes of stack for auto variables?

void func(void)
{
char a, b;
    ...
}

I thought gcc aligned to 32 bit words auto variables 
for efficiency reasons, like with struct members, thus 
allocating 8 bytes in the above example. 
More or less equivalent to this:

struct char_ab {
  char a, b;
};

void func(void)
{
struct char_ab ab;
    ...
}

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