Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!brl-adm!brl-sem!ron
From: ron@brl-sem.ARPA (Ron Natalie )
Newsgroups: comp.lang.c
Subject: Re: is it really necessary for character values to be positive?
Message-ID: <548@brl-sem.ARPA>
Date: Tue, 30-Dec-86 13:12:38 EST
Article-I.D.: brl-sem.548
Posted: Tue Dec 30 13:12:38 1986
Date-Received: Tue, 30-Dec-86 21:39:10 EST
References: <39@houligan.UUCP> <289@haddock.UUCP>
Organization: Electronic Brain Research Lab
Lines: 13

In article <289@haddock.UUCP>, karl@haddock.UUCP (Karl Heuer) writes:
> 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 == '@') ... }

Getchar returns int.  The int has a character in it.  Before trying to
use it as such, you ought to either place it back into a character
variable explicitly or use a cast to char...

     main() { int c; ... c = getchar(); ... if ((char) c == '@') ... }