Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!cmcl2!seismo!brl-adm!brl-smoke!smoke!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: Re: A simple non-portable expression tha Message-ID: <130@brl-smoke.ARPA> Date: Sat, 19-Apr-86 02:24:03 EST Article-I.D.: brl-smok.130 Posted: Sat Apr 19 02:24:03 1986 Date-Received: Mon, 21-Apr-86 07:37:41 EST Sender: news@brl-smoke.ARPA Lines: 14 No, the compiler is not free to associate right-to-left in an expression long + int + int. Addition associates left-to-right, and the integral widening conventions apply, so the middle term must be converted to long and added to the leftmost term before the rightmost term is added. The compiler is allowed to reorder this only if it guarantees the same answer as would be obtained by following the rules. On machines where integer overflow is ignored, the opportunity arises more frequently than on those where it traps. However, in this example, information could be lost by overflow if the compiler treated the expression as long + (int + int) so it is not allowed to do that.