signed/unsigned [etc ...]
Jonathan D. Becher
becher at armada.UUCP
Sat Dec 10 03:34:42 AEST 1988
In a previous article, T. William Wells (bill at twwells.uucp) flames
Piercarlo Grandi (pcg at cs.aber.ac.uk):
> As for simplifying the type system; the current one is as simple as
> is possible for it to be, given that it *must* be compatible with the
> old one, and given the addition of a `signed char'.
Ease up Bill.
Sure, it's a given that we need to be backwards compatible with the type
system of C. But the type system could be simpler - if we were
designing the language today we would almost certainly opt for more
structure and less ambiguity.
>> [1] there are two distinct types, int and unsigned; they are distinct
>> types because different rules of arithmetic apply to them.
> ... you are wrong about there being two distinct
> types; from the view you are adopting, there are three. See below.
>> [2] Each of the two distinct types may come in three different extra
>> lengths, char, short and long ...
> Let me repeat this: there are three signednesses in C:
> 1) integers - these have positive and negative values.
> 2) unsigned - these have positive values only.
> 3) char - these have positive values. Sometimes they have
> negative values as well but it depends on the implementation.
We splitting semantic hairs here. "Type" is whatever you define it to be.
For my money, there are 14 type specifiers in C (see section 3.5.2 draft
ANSI C). We can rule out typedef's since they are user-defined and
claim that there are 13 base types.
It's all in the view.
> `Char int' is, and always has been, illegal. I don't know of a single
> compiler that accepts it.
Okay, but I do. The current version of GNUs C++ compiler accepts it.
In fact, it accepts int int also.
Face it Bill, the type system isn't as consistent from a parsing
perspective as it might be. It is more than adequate however; and, as
you pointed out, there are compelling historical reasons not to abandon
it. But let's not be a C snob.
Jon Becher
argosy!becher at decwrl.dec.com
"Are you *the* Zaphod Beeblebrox!?!" "Count the heads."
More information about the Comp.lang.c
mailing list