Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!houxm!mtuxo!mtune!codas!peora!pesnta!wjvax!brett From: brett@wjvax.UUCP (Brett Galloway) Newsgroups: net.lang.c Subject: Re: Promotion of integral types Message-ID: <761@wjvax.wjvax.UUCP> Date: Fri, 26-Sep-86 15:19:45 EDT Article-I.D.: wjvax.761 Posted: Fri Sep 26 15:19:45 1986 Date-Received: Tue, 30-Sep-86 06:06:02 EDT References: <3594@brl-smoke.ARPA> <1219@drutx.UUCP> <2233@gitpyr.UUCP> <547@chinet.UUCP> <3422@umcp-cs.UUCP> <271@myrias.UUCP> Reply-To: brett@wjvax.UUCP (Brett Galloway) Organization: Watkins-Johnson Co., San Jose, Calif. Lines: 29 In article <271@myrias.UUCP> cmt@myrias.UUCP (Chris Thomson) writes: >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 >> [more types] >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. I disagree. One cannot assume that sizeof(int) > sizeof(short). -- ------------- Brett Galloway {pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett