Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!think!mit-eddie!genrad!decvax!tektronix!uw-beaver!ubc-vision!alberta!myrias!cmt From: cmt@myrias.UUCP (Chris Thomson) Newsgroups: net.lang.c Subject: Promotion of integral types Message-ID: <271@myrias.UUCP> Date: Tue, 23-Sep-86 04:35:37 EDT Article-I.D.: myrias.271 Posted: Tue Sep 23 04:35:37 1986 Date-Received: Thu, 25-Sep-86 07:30:03 EDT References: <3594@brl-smoke.ARPA> <1219@drutx.UUCP> <2233@gitpyr.UUCP> <547@chinet.UUCP> <3422@umcp-cs.UUCP> Organization: Myrias Research, Edmonton Lines: 31 In article <3422@umcp-cs.UUCP> Chris Torek writes: > Storage Type Expression Equivalent > ------------ --------------------- > char int > unsigned char unsigned int > short int > unsigned short unsigned int > int int > unsigned int unsigned int > long long > unsigned long unsigned long > float double > double double > pointer pointer It is interesting to note that K&R does not say that unsigned char or unsigned short get promoted to unsigned int; it says that they get promoted to integer (on page 183), which is a bit vague. Harbison & Steele says very clearly what is said above. The ANSI Draft (1986.07.09 version) says very clearly that unsigned char and unsigned short are promoted to int, since the values can all be represented in an int (assuming sizeof(int) is greater than sizeof(short), which is usually true). What to do? Frankly, I prefer the ANSI approach, but it does represent a silent change from what H&S (and Chris Torek) perceive to be standard practice. For some reason, it is not flagged as such in the rationale document; it isn't even discussed there. -- Chris Thomson, Myrias Research Corporation alberta!myrias!cmt 200 10328 81 Ave, Edmonton Alberta, Canada 403-432-1616