i = i * f *vs* i *= f (Not a bug)

Charles LaBrec crl at pur-phy.UUCP
Tue Apr 17 18:32:32 AEST 1984


However, pulling out the trusty K&R says (pg 191, Sec 7.14)

	The behavior of an expression of the form E1 op= E2 may be
	inferred by taking it as equivalent to E1 = E1 op (E2) ....

So i *= .2 should be evaluated as i = i * .2, which is a very legal
mixed mode operation where i gets converted to a double, multiplied
by .2, truncated to an integer, and assigned to i.

Charles LaBrec
UUCP:		pur-ee!Physics:crl, purdue!Physics:crl
INTERNET:	crl @ pur-phy.UUCP



More information about the Comp.lang.c mailing list