Xref: utzoo comp.lang.c:12779 comp.lang.fortran:1203 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!novavax!proxftl!francis From: francis@proxftl.UUCP (Francis H. Yu) Newsgroups: comp.lang.c,comp.lang.fortran Subject: Re: C associativity rules Keywords: associativity, expressions Message-ID: <804@proxftl.UUCP> Date: 21 Sep 88 17:22:51 GMT References: <412@marob.MASA.COM> Reply-To: francis@proxftl.UUCP (Francis H. Yu) Organization: Proximity Technology, Ft. Lauderdale Lines: 17 In article <412@marob.MASA.COM> samperi@marob.MASA.COM (Dominick Samperi) writes: >Does K&R C or the new ANSI C permit the compiler to evaluate an expression >like a+b+c in any order it pleases, rather than in the strict left-to-right >order (a+b)+c ? I've always assumed that a strict left-to-right order would >be used, as is the case for relational expressions like the one in the >following. > while(i != -1 && a[i] != k) > whatever ; "a && b" is a control structure which implies "if (a) if (b) ... " It has nothing to do with the order of evaluation of expression. "Arithmetic operators associate left to right" - pp 41, K&R C Second Edition