C associativity rules
Francis H. Yu
francis at proxftl.UUCP
Thu Sep 22 03:22:51 AEST 1988
In article <412 at marob.MASA.COM> samperi at 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
More information about the Comp.lang.c
mailing list