signed char

Guy Harris guy at sun.uucp
Mon Nov 3 17:35:53 AEST 1986


> ...However, there is a compiler option that will make all chars unsigned,
> so if you're porting something from a VAX, you can have it that way too.

If you're porting something from a VAX, you're in for one hell of a surprise
if you turn on the "make chars unsigned by default" option; the UNIX C
compiler for the VAX (and probably the VMS compiler as well) treats "char"
as a request for a signed character.

> I have never found a use for signed chars.

V6 UNIX did; the "p_pri" field in the "proc" structure held the process
priority, and the range of priorities included both positive and negative
values.  Since V7 was ported to an Interdata machine, whose compiler treated
"char" as a request for an unsigned character, an bias PZERO was added so
that the range of priorities started at 0.

Note, however, that this was a use for signed "char"s, NOT for signed
characters.  Unfortunately, C conflates the notion of "character" and "very
small integer" into one type, namely "char".
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.lang.c mailing list