signed/unsigned char/short/int/long

Ray Dunn ray at micomvax.UUCP
Fri Dec 16 07:34:00 AEST 1988


In article <347 at aber-cs.UUCP> pcg at cs.aber.ac.uk (Piercarlo Grandi) writes:
>
>What I am asking is why X3J11 did not legalize the combination "int char",
>hitherto not legal, but accepted by some popular compilers because of an
>easily explained benign mistake, to mean "signed char", WITHOUT the
>introduction of a new keyword with further complication of the rules for
>declarations. I cannot believe they did not think of it...
>

Introducing "signed" certainly adds another keyword to the language, just as
it certainly does not introduce a new concept.

Overloading the keyword "int" with a new meaning is, to me, both ad-hoc and
unfortunate.  The logic appears to be: ints are signed, so int can be used
to *imply* signed.  Hmm.  Dog's breathe so everything that breathes is a
dog?

How much more "further complication of the rules for declarations" are involved
in the introduction of "signed" than allowing "int char"?

Why shouldn't "int char" also imply something about the *size* of the char?
Yes, I know, because you have made the ad-hoc definition that it shouldn't,
because to you (alone?) "int" implies something about signedness.

The fundamental hole in your approach is saying that the two types we are
talking about are "int" and "unsigned".  If you want to argue from that
angle, then you should be saying "int" and "unsigned int".  As a default
shorthand convenience (only) we are allowed to not specify the "int"
following "unsigned".  Using this same concept, we are allowed to omit the
"signed" when it precedes "int" etc.  The only confusion is an *historical*
confusion, i.e. what is the default signedness of "char"?

All of the above assumes of course that we are discussing 'C' with its large
body of existing code which must continue to be supported, and not some
as-yet-to-be-invented language that is still just a wish-list in your mind.
If it is the latter, then of course, everything you say could be possible!

-- 
Ray Dunn.                      |   UUCP: ..!philabs!micomvax!ray
Philips Electronics Ltd.       |   TEL : (514) 744-8200   Ext: 2347
600 Dr Frederik Philips Blvd   |   FAX : (514) 744-6455
St Laurent. Quebec.  H4M 2S9   |   TLX : 05-824090



More information about the Comp.lang.c mailing list