Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: ANSIfication: value preserving rules Message-ID: <7651@brl-smoke.ARPA> Date: 10 Apr 88 23:25:21 GMT References: <10830@mimsy.UUCP> <11000@mimsy.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 32 In article <11000@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >In find it significant that the unsigned preserving rules can be stated >in four words, while the value preserving rules require a paragraph >full of conditional wording. Although I did not support the adoption of value-preserving rules (and AT&T's representatives vociferously opposed it), I feel obliged to note that you have carefully arranged the argument to put the best light on your preference. It takes more than 4 words to express the complete signedness-preserving rules! In fact the complete conversion rules are approximately as difficult to express completely for either approach. The following example shows what X3J11 seems to have had in mind when adopting value-preserving rules (which were based on some subset of existing practice, by the way): unsigned short us = 1; int i = us - 2; printf("%d\n",i); which one would think should print "-1", which it does under the value-preserving rules but not under the signedness-preserving rules. It has been reported that when AT&T recompiled all the UNIX system sources with an experimental value-preserving compiler, practically nothing broke. My experience has been that mixed-signedness expressions have tended to be buggy under signedness-preserving rules and that a change to value-preserving rules would straighten out some of the bugs I have encountered. The bottom line is that this is a change we can probably live with.