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!dataioDat!bright@dataioDat From: bright@dataioDat Newsgroups: net.lang.c Subject: Re: A simple non-portable expression tha Message-ID: <972@dataioDat> Date: Mon, 28-Apr-86 22:23:00 EDT Article-I.D.: dataioDa.972 Posted: Mon Apr 28 22:23:00 1986 Date-Received: Tue, 13-May-86 00:29:20 EDT References: <1368@ism780c> Lines: 13 In article <2609@utcsri.UUCP> greg@utcsri.UUCP (Gregory Smith) writes: >However, I tried this ( using 16-bit short ints for I1,I2 ) on our >native vax compiler and on our 68K compiler. Both produced identical code >for (L+I1)+I2 and L+(I1+I2) and L+I1+I2: specifically, ((long)I1+L)+(long)I2. >I guess the a+b+c is recognized as a special case, and all three are widened >to a common width regardless of the original associativityy Shorts in C are always converted to ints before they are used. On the vax and most 68k compilers, ints are the same as longs. Therefore, this isn't any 'special case' recognized by the compiler. Different code for (L+I1)+I2 and L+(I1+I2) will only be generated if ints are smaller than longs.