Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!hpda!hpisoa2!hpitg!brl-smoke!ARPA@brl-smoke From: ARPA@brl-smoke Newsgroups: net.lang.c Subject: Re: A simple non-portable expression tha Message-ID: <322@brl-smoke> Date: Mon, 28-Apr-86 05:42:00 EDT Article-I.D.: brl-smok.322 Posted: Mon Apr 28 05:42:00 1986 Date-Received: Tue, 13-May-86 00:28:05 EDT References: <1368@ism780c> Lines: 27 Re: Long + (Int1 + Int2) This really does call for Int1 and Int2 to be added first, without widening to (long), then the sum widened and added to Long. You have to watch out when trying to test this on a system where sizeof(int)==sizeof(long), though: the "integral widening conventions" will cause (short)s to be widened to (int) before adding if you're trying to test this by making Int1 and Int2 (short)s. The Ritchie PDP-11 C compiler does correctly distinguish between Long + (Int1 + Int2) and Long + Int1 + Int2 which result in different machine instruction sequences. An additional note: I've had a lot of trouble with code semantics getting screwed up by PCC's derived from Berkeley's (which in turn seems to have been borrowed from USG 3.0). Types don't propagate correctly in expressions, casts are ignored, etc. A real mess. I tried using the 4.2BSD PCC to generate code for my UNIX System V emulation, but finally out of disgust adapted the SVR2 PCC instead. I know Donn Seeley has been working on the Berkeley PCC, so perhaps the 4.3BSD version will be better. Why Berkeley insists on not using any AT&T software released after 1979 I don't know; their "licensing" argument doesn't hold water. I would urge all UNIX system vendors to start with SGS2/PCC2, or at least the latest AT&T "old PCC", rather than the 4.2BSD PCC that some seem to have used.