Sujet : Re: technology discussion → does the world need a "new" C ?
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 06. Jul 2024, 06:46:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6alnj$3mij1$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 7/5/24 21:38, Lawrence D'Oliveiro wrote:
On Fri, 5 Jul 2024 14:31:44 +0100, bart wrote:
C also is the only language that is supposed to work on any kind of
processor ...
I don’t think there is anything innate in the design of C to ensure that.
It is, however, a deliberate design goal of the C committee to make the
language widely implementable. Many kinds of unspecified and undefined
behavior are unspecified or undefined in order to allow unusual
architectures to have a fully conforming implementation of C - a fact
which drives bart crazy(er).
It was simply its popularity that meant it was usually the first language
implemented on a new processor.
For example, C assumes byte addressability. ...
True. However, C is widely implementable because of the fact that it
defines a "byte" as containing CHAR_BIT bits, and makes the value of
CHAR_BIT implementation-defined, subject only to the restriction that
CHAR_BIT is an integer and >= 8. Also, bytes don't need to be hardware
addressable, byte addressability can be emulated in software, and often
is on machines with a word size > 8.
There are machines which cannot be configured to support that model for
any permitted value of CHAR_BIT, but not many.
... So that causes awkwardness on
architectures like the PDP-10, for example.
While I was learning C at the time, I vaguely recall programming the
PDP-10 using Fortran IV more than five decades ago. I was far less
knowledgeable about computers than I am now, so I might not have
noticed. What problems are you referring to?