Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-spam!mordor!styx!lll-lcc!ames!cit-vax!cit-vlsi!wen-king From: wen-king@cit-vlsi.UUCP Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: Tty characters 'undefined' value revisited Message-ID: <1704@cit-vax.Caltech.Edu> Date: Thu, 5-Feb-87 15:03:59 EST Article-I.D.: cit-vax.1704 Posted: Thu Feb 5 15:03:59 1987 Date-Received: Sat, 7-Feb-87 14:41:46 EST References: <152@quacky.mips.UUCP> Sender: news@cit-vax.Caltech.Edu Reply-To: wen-king@cit-vlsi.UUCP (Wen-King Su) Organization: California Institute of Technology Lines: 29 Xref: watmath comp.unix.wizards:847 comp.unix.questions:928 In article <152@quacky.mips.UUCP> dce@quacky.UUCP (David Elliott) writes: > >Basically, >the problem is that the 4.3BSD documentation says that a value of -1 >means 'undefined', but our compilers generate unsigned characters. > >The general concensus of the responses I got is that the ttychars >structure should be changed so that all of the members are shorts or >ints instead of chars. > >Can anyone think of a reason NOT to do this? Are there places where >these values are expected to be chars, and will broken by this change? I remember vaguely that you were having problems comparing chars to the constant -1. The comparison: char c; c = -1; if(c == -1) ... tests true on one some but false on others. That is to be expected because C does not specify how chars are to be casted to ints. What you can do is to do the comparison like this: char c; c = -1; if(c == (char) -1) ... This should test true on all machines.