www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/25/10:22:29

From: Hans-Bernhard Broeker <broeker AT acp3bf DOT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Length of Chars...
Date: 25 Jan 2000 09:10:10 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 20
Distribution: world
Message-ID: <86jp9i$3u9$1@nets3.rz.RWTH-Aachen.DE>
References: <3888ED7B DOT DF52FEB2 AT ou DOT edu> <38896068 DOT 8C5927C0 AT is DOT elta DOT co DOT il> <388A0530 DOT DF2B2F31 AT ou DOT edu> <q72k8s8heuhu5c7198uioge8lc8kobjht8 AT 4ax DOT com> <86hklo$dot$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <86itfi$l1r$1 AT gateway DOT qnx DOT com>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 948791410 4041 137.226.32.75 (25 Jan 2000 09:10:10 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 25 Jan 2000 09:10:10 GMT
User-Agent: tin/1.4-19991113 ("No Labels") (UNIX) (Linux/2.0.0 (i586))
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Alain Magloire <alain AT qnx DOT com> wrote:
> Hans-Bernhard Broeker (broeker AT acp3bf DOT physik DOT rwth-aachen DOT de) wrote:

> : For short: char, like all the C data types, is implementation defined.
> : You should never assume it's 8 bits, if you can help it, as that
> : renders your program unportable.

> Yes.  But If I recall ISO C requires that the size/range of the
> char types be defined in <limits.h>.  Althought 8 bits is widely use
> I've heard of implementations that used 9 bits.

Exactly my point: no-one should silently assume char is 8 bits, but
instead look into CHAR_BITS, as defined by the implementation's
<limits.h> to *check* if it really is 8 bits. Or, even better, look up
that value and use it to scale your arrays, if you really feel you
can't allow wasting the bits beyond the 8th that are present in a
char.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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