delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/13/12:29:41

Date: Thu, 13 May 1999 18:29:12 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199905131629.SAA32708@acp3bf.physik.rwth-aachen.de>
To: djgpp AT delorie DOT com
Subject: Re: Portability and size_t type related question
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <Pine DOT SUN DOT 3 DOT 91 DOT 990513161505 DOT 12629T-100000 AT is> you wrote:

> On Thu, 13 May 1999, Guillermo Rodriguez Garcia wrote:

> > >> Like 'char' is always 1 byte.
> > >
> > >That's not true, either.  There are compilers (mostly for embedded 
> > >systems) where `char' is 32-bit wide.
> > 
> > Then a byte is defined as 32 bits on those systems.

> AFAIK, there's no such thing as a `byte' in the C language description.  

At least in the C9x draft standard, there is. Quote:

       3.4
       [#1] byte
       addressable  unit  of  data storage large enough to hold any
       member  of  the  basic  character  set  of   the   execution
       environment
[...]
       3.5
       [#1] character
       bit representation that fits in a byte

AFAIK, effectively the same definition is part of the current C89
standard as well.
 
> Most people think that byte is a synonym for 8 bits.

I'm aware of that. But that doesn't make it correct, at least not from
a 'language-lawyer' point of view. Actually, the equivalence of 8 bits
being a byte is a rather recent invention, compared to the use of the
'byte' in computing. There have been 7-bit bytes, 9-bit ones. 8 bits
just happens to be *so* common today that most of us, esp. those who
grew up on 8-bit home-computers, tend to think it's the only possible
definition.

You see, there *is* a reason that the 8-bit byte is called 'octet' in
several other standards (X11, MIME, e.g.): the term 'byte' really
isn't specific enough, if a standard writer wants to nail down an
implementor to do exactly what the standard says.

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