[comp.lang.c] signed/unsigned etc ...

becher@armada.UUCP (Jonathan D. Becher) (12/10/88)

In a previous article, T. William Wells (bill@twwells.uucp) flames
Piercarlo Grandi (pcg@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@decwrl.dec.com

"Are you *the* Zaphod Beeblebrox!?!"  "Count the heads."

bill@twwells.uucp (T. William Wells) (12/15/88)

In article <76@armada.UUCP> becher@armada.UUCP (Jonathan D. Becher) writes:
: In article <244@twwells.uucp>, T. William Wells (bill@twwells.uucp) flames
: Piercarlo Grandi (pcg@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.

I didn't say it couldn't be simpler. I said what I said.  Read it
again.  Mr. Grandi wasn't offering suggestions for D, he was offering
suggestions for C. And, within that context, which requires
consideration of the points I mentioned, it can't be simpler.

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

*We* aren't spliting semantic hairs. *You* are misreading me.  Read
again the material you quoted.  The discussion was about signedness
as an important distinguishing characteristic of types.  He was
saying there are *two* kinds of signedness. This is not true, and it
needed pointing out.

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

C++ is not C. And GNU's C compiler, version 1.22, (the version I have)
does not accept this incorrect construct.

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

Face it Jon, your comments are not germane. I wasn't defending the
existing type system, I was *describing* it. I understand perfectly
well that the type system could be better; I even have my own ideas on
this. However, this is irrelevant to questions of the *facts* of C,
which the person whom I flamed got wrong.

Mr. Becher, if you have anything further to say on this subject,
please use e-mail. I'm not willing to further spend net bandwidth on
it.

---
Bill
{uunet|novavax}!proxftl!twwells!bill