🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3965

Re: Bytes & Chars (Was: Re: SBEIR)

#3965
From: Mark Brader
Date: Sun, 10 Sep 1995 19:39
33 lines
2143 bytes
Markus Freericks (mfx@cs.tu-berlin.de) writes:
> Wouldn't it simplify the understanding of the standard if the term "byte"
> was either totally removed from the standard (as it is currently synonymous
> with "char"), or totally separated from it?

It's not actually synonymous: the two things are the same size, but one is
a data type and the other is a unit that storage comes in.
 
> As it is, I don't see any value to the term "byte". Now if "byte" was
> defined as the smallest addressable unit of memory, and sizeof(char) >= 1
> (e.g., sizeof(char)==2 on a nybble-addressable machine, if such a beast
> exists), bytes would be very useful..

This sort of thing was proposed during standardization, not so much for
the benefit of "nybble-addressable machines" as for those addressed in
8-bit units but using 2 or more of those units for a character (as in
Unicode and other character sets handling languages like Japanese).

The committee basically felt that such a change would break too much
existing code; although not promised in K&R1, it was generally assumed
that sizeof(char) would always be 1.  The Rationale, in section 3.3.3.4,
puts this terms that seem a bit too emphatic to me:  "It is fundamental to
the correct usage of functions such as malloc and fread that sizeof (char)
be exactly one."

Since the standard continues to promise the sizeof(char) is 1, it is
equally infeasible to introduce this change today.
-- 
Mark Brader            | "I don't care HOW you format   char c; while ((c =
msb@sq.com             |  getchar()) != EOF) putchar(c);   ... this code is a
SoftQuad Inc., Toronto |  bug waiting to happen from the outset." --Doug Gwyn

My text in this article is in the public domain.
Technical Details
Message-ID: <1995Sep10.193929.26714@sq.com>
Path: arc1-ca.pugleaf.net!spool.mu.edu!torn!sq!msb
References: <DDvt89.Jx5@sco.COM> <6495251.39947.23296@kcbbs.gen.nz> <zudUwQ9ytVYE084yn@csn.net> <42vd3s$t58@news.cs.tu-berlin.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!spool.mu.edu!torn!sq!msb
From: msb@sq.com (Mark Brader)
Subject: Re: Bytes & Chars (Was: Re: SBEIR)
Message-ID: <1995Sep10.193929.26714@sq.com>
Organization: SoftQuad Inc., Toronto, Canada
References: <DDvt89.Jx5@sco.COM> <6495251.39947.23296@kcbbs.gen.nz> <zudUwQ9ytVYE084yn@csn.net> <42vd3s$t58@news.cs.tu-berlin.de>
Date: Sun, 10 Sep 1995 19:39:29 GMT