delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/24/11:01:31

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: 24 Jan 2000 13:39:04 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 30
Distribution: world
Message-ID: <86hklo$dot$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>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 948721144 14109 137.226.32.75 (24 Jan 2000 13:39:04 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 24 Jan 2000 13:39:04 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

Damian Yerrick <MYNAMEISd_yerrick AT hotmail DOT comno2cannedham> wrote:
> On Sat, 22 Jan 2000 13:29:52 -0600, David Cleaver <davidis AT ou DOT edu>
> wrote:

>>However, if the char type ever increases in size, my tables
>>wouldn't be as tighly packed as possible, so I wanted to
>>know if it was ever going to change.

> The .txt file format specification depends on a one-byte 'char' type;
> I don't see it changing soon.

What '.txt file format specification' would that be? On what machine?

Technically speaking, C doesn't care a bit about how 'text' is
represented in files, outside the program. It's the duty of the
stdio.h functions to translate whatever there is, out there, into the
C type of 'a long stream of 'char' values'.

And yes, there *are* C compilers out there for which a char is not 8
bits. Mostly for 'exotic' hardware, like Digital Signal Processors
(DSPs) that don't have any support for units of data smaller than
32bits, but that doesn't mean they're not perfectly valid ANSI C
compilers.

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.
-- 
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