delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/13/06:07:56

Date: Thu, 13 May 1999 12:38:28 +0300 (EET DST)
From: Eugene Ageenko <ageson AT cs DOT joensuu DOT fi>
To: Pasi Franti <franti AT cs DOT joensuu DOT fi>
cc: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp AT delorie DOT com
Subject: Re: Portability and size_t type related question
In-Reply-To: <Pine.SOL.4.10.9905130944050.5527-100000@cs.joensuu.fi>
Message-ID: <Pine.SOL.4.10.9905131234130.10011-100000@cs.joensuu.fi>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On Thu, 13 May 1999, Pasi Franti wrote:

> 
> > Ok. thanx. it is like here then:
> > 
> > typedef  unsigned short    U16;
> > typedef  unsigned long     U32;
> > typedef  unsigned char     BYTE;
> 
> I disagree.
> 
> I did not follow your discussion but how did you come up to such
> conclusion? You can never be sure of how many bits are int and 
> long types without checking it! So what makes you think that 
> unsigned long would be different case? As far as I know, it is
> more likely to be U64 as we use 32-bit compilers where int is
> 32 bits and long 64 bits.


You did not followed the discussion.

We have said that these definitions above are system dependnet and should
be set separately for each system. Therefore .H files are so long
sometimes. All these system dependent definitions are better done in a
separate .h file for easier checking.

(like owntypes.h)

The user of system will check this file.

If he has 64-bit system hw would be probably need to change definition for
UINT32 type. But it is easier to do in a separate file than to dig the
software again and again, and find which int's should go to long's and
vice versa.

Currently there is no PORTABLE way in the current ANSI C to specify how
many bytes will take the variable.

> 
> In fact, even char is not necessary 8 bits even though it is
> so almost everywhere.

It is what Eli and Dj said, exactly

> 
> If you have some reasoning for this, please let me know.
> 

Eugene 

- Raw text -


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