C associativity rules

Dominick Samperi samperi at marob.MASA.COM
Tue Sep 13 11:22:14 AEST 1988


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 ;

Apparently FORTRAN permits the compiler to evaluate the expression in any order
it pleases, for optimization purposes.
-- 
Dominick Samperi, NYC
    samperi at acf8.NYU.EDU	samperi at marob.MASA.COM
    cmcl2!phri!marob        	uunet!hombre!samperi
      (^ ell)



More information about the Comp.lang.c mailing list