Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!ima!haddock!karl
From: karl@haddock.UUCP (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: is it really necessary for character values to be positive?
Message-ID: <289@haddock.UUCP>
Date: Wed, 24-Dec-86 16:05:18 EST
Article-I.D.: haddock.289
Posted: Wed Dec 24 16:05:18 1986
Date-Received: Wed, 24-Dec-86 21:38:16 EST
References: <39@houligan.UUCP>
Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 15
Summary: yes

In article <39@houligan.UUCP> dave@murphy.UUCP writes:
>Summary: invent an 8-bit character set and then let some of them be negative

Suppose I am using such a system, and one of the characters -- call it '@' --
has a negative value.  The following program will not work:
    main() { int c; ... c = getchar(); ... if (c == '@') ... }
Note that getchar() returns an UNSIGNED char on success; this is to guarantee
that none of them compare equal to EOF.  Thus, any printing character that I
want to enclose in single quotes had better be positive, or it becomes VERY
awkward to use.

Please don't suggest that getchar() should return a signed char and that
'\377' should be reserved.  It won't work.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint