Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site rlgvax.UUCP Path: utzoo!linus!philabs!seismo!rlgvax!guy From: guy@rlgvax.UUCP Newsgroups: net.lang.c Subject: Re: type casting problem Message-ID: <618@rlgvax.UUCP> Date: Fri, 10-Jun-83 22:15:07 EDT Article-I.D.: rlgvax.618 Posted: Fri Jun 10 22:15:07 1983 Date-Received: Sat, 11-Jun-83 23:31:03 EDT References: decvax.112 <3099@root44.UUCP> Organization: RLG Corp., Reston, VA Lines: 18 Unfortunately, the V7 PDP-11 C compiler does not support "unsigned char". The System III PDP-11 C compiler, and the C compiler on all later versions of USG UNIX (USG UNIX n, for n >= 3.0), do support it. If you take the term "char" at face value, there is no such thing as a "signed" or "unsigned" char. What is the sign of 'q'? But since C doesn't have a "veryshort int" (or "veryshort unsigned int") datatype, "char" is overloaded to mean "one byte int" as well as "character". I suspect "unsigned char" was added because on all 11-family machines, "char" is signed, and somebody wanted a more convenient way of getting an unsigned one byte integer. On some machines, the hardware supports both kinds, and can handle unsigned characters more efficiently than by masking with 0377. "unsigned char" is guaranteed not to be signed, but "char" is not guaranteed to be either signed nor unsigned; on the Western Electric 3B machines, "char" is unsigned. Guy Harris RLG Corporation {seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy