Article View: net.lang.c
Article #9402Re: Promotion of integral types
From: Tom Kelly
Date: Fri, 26 Sep 1986 12:23
Date: Fri, 26 Sep 1986 12:23
34 lines
2098 bytes
2098 bytes
In article <271@myrias.UUCP> cmt@myrias.UUCP (Chris Thomson) writes:
> ... 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.
This change was the subject of long and hard investigation and
debate in the ANSI C (X3J11) committee. It is a quiet change
from common practice in (for example) PCC-based compilers, but
there are other implementations that do promote unsigned
char and unsigned short to int. The decision was not made lightly -
the debate went on for at least a year.
The issue is discussed at length in the Rationale (86-099 7 July 1986),
in 3.2 Conversions (pp. 32-33). In particular, on p 33:
QUIET CHANGE
A program that depends upon unsigned preserving arithmetic
conversions will behave differently, probably without
complaint. This is considered the most serious semantic
change made by the Committee to a widespread current
practice.
Tom Kelly (416) 922-1937
Human Computing Resources Corp.
{utzoo, ihnp4, decvax}!hcr!hcrvx1!tom
Technical Details
Message-ID:
<1405@hcrvx1.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!hcrvx1!tomReferences:
<3594@brl-smoke.ARPA> <1219@drutx.UUCP> <2233@gitpyr.UUCP> <547@chinet.UUCP> <3422@umcp-cs.UUCP> <271@myrias.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcrvx1.UUCP Path: arc1-ca.pugleaf.net!utzoo!hcrvx1!tom From: tom@hcrvx1.UUCP (Tom Kelly) Newsgroups: net.lang.c Subject: Re: Promotion of integral types Message-ID: <1405@hcrvx1.UUCP> Date: Fri, 26-Sep-86 08:23:39 EDT Article-I.D.: hcrvx1.1405 Posted: Fri Sep 26 08:23:39 1986 Date-Received: Sat, 27-Sep-86 00:23:23 EDT References: <3594@brl-smoke.ARPA> <1219@drutx.UUCP> <2233@gitpyr.UUCP> <547@chinet.UUCP> <3422@umcp-cs.UUCP> <271@myrias.UUCP> Reply-To: tom@hcrvx1.UUCP (Tom Kelly) Organization: Human Computing Resources, Toronto Lines: 34