draft ANSI standard: one change that would *really* help Europe

Karl Heuer karl at haddock.UUCP
Fri Dec 5 13:05:51 AEST 1986


In article <8322 at lll-crg.ARpA> bandy at lll-crg.UUCP (Andrew Scott Beals) writes:
>In article <1382 at hoptoad.uucp> gnu at hoptoad.uucp (John Gilmore) writes:
>>[We really need an 8-bit character set and C needs to acknowledge this]
>>[John thinks that perhaps "char" should be unsigned - most programs
>  would be more correct since they assUme that chars are unsigned]
>
>Well, I heartily agree, but I think that there must be some programs
>out there that assume that chars are useful as small signed numbers,
>which I would also prefer not to break.  

They are already broken.

>Also, I think that having chars have different semantics (assumed unsigned
>rather than signed like int) would be a bad thing in general.  Perhaps
>what is needed is a "tiny" type (ala long and short) that would be signed
>and (for now) essentially a signed char.

ANSI already has it, and it's called "signed char".

Back to the previous question.  I think the original reason for leaving the
signedness of plain "char" unspecified is still valid: a program that deals
with 7-bit USASCII doesn't care whether char is signed or not, and it's nice
to have the compiler use the more efficient mode (which is signed, on the
pdp11.)  However, K&R and X3J11 both state that all members of the normal
character set are positive; I would interpret this to mean that international
implementations with non-USASCII printing characters must make "char" an
unsigned type*.  (I think some implementors disagree, so the point needs to
be clarified by X3J11.)

As for the trigraphs (I have to justify continuing to cross-post this), maybe
they're necessary for antique card-punches?  I got the impression that they
were necessary because ANSI didn't want to bind the language to ASCII, so
they only insisted on those characters in some ANSI standard character set.
(I wonder if there are any programs that will break because they have "??" in
the middle of a string someplace...)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
*Or, a signed type with nine or more bits.



More information about the Comp.lang.c mailing list