Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!houxz!vax135!floyd!cmcl2!rna!n44a!wjh12!vaxine!linus!bbncca!keesan From: keesan@bbncca.UUCP Newsgroups: net.unix-wizards Subject: Re: unsigned char -> unsigned int conversion Message-ID: <778@bbncca.UUCP> Date: Tue, 12-Jun-84 10:20:27 EDT Article-I.D.: bbncca.778 Posted: Tue Jun 12 10:20:27 1984 Date-Received: Thu, 14-Jun-84 01:47:15 EDT References: <183@haddock.UUCP> Lines: 30 ------------------------------ haddock!lee says, > Note that "char" is part of the sequence char-short-int-long, whereas > "unsigned char" is part of the sequence uchar-ushort-uint-ulong, where the > second sequence has the property "unsigned". During coercions, unsigned > chars are extended to unsigned whereas chars are extended to int (by zero > extension or sign extension, whichever is appropriate). What are you using as a reference? Clearly not Kernighan & Ritchie, since unsigned chars weren't invented as of publication. The only reference I have to unsigned chars is "The C Programming Language" in the System V "Programming Guide", and it doesn't allow unsigned short or unsigned long. Is this a Berkeleyism? What does the current draft ANSI standard say about it? In upgrading our local C compiler to be System V compatible, I blithely assumed that since our chars are unsigned, all I had to do was the syntactic magic to make "unsigned char" equivalent to "char". A careful reading of the System V C manual leaves the question up in the air. Their section on the usual arithmetic conversions omits any mention of unsigned char (an obvious oversight). Would somebody with a Bell Labs System V C compiler try Lee's unsigned char foo=1; if( (-1|foo) > 0 ) printf("-1 is negative\n"); and report what it does? Thanks. -- Morris M. Keesan {decvax,linus,wjh12,ima}!bbncca!keesan keesan @ BBN-UNIX.ARPA