Article View: net.lang.c
Article #9703Re: signed char
From: Guy Harris
Date: Mon, 03 Nov 1986 07:35
Date: Mon, 03 Nov 1986 07:35
23 lines
1548 bytes
1548 bytes
> ...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@sun.com (or guy@sun.arpa)
Technical Details
Message-ID:
<8828@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!nike!oliveb!sun!guyReferences:
<140@houligan.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!nike!oliveb!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c Subject: Re: signed char Message-ID: <8828@sun.uucp> Date: Mon, 3-Nov-86 02:35:53 EST Article-I.D.: sun.8828 Posted: Mon Nov 3 02:35:53 1986 Date-Received: Tue, 4-Nov-86 03:36:05 EST References: <140@houligan.UUCP> Organization: Sun Microsystems, Inc. Lines: 23