Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!harpo!decvax!mcvax!guido From: guido@mcvax.UUCP (Guido van Rossum) Newsgroups: net.lang.c Subject: Re: i = i * f *vs* i *= f (Not a bug) (Oh yes it is) Message-ID: <5781@mcvax.UUCP> Date: Mon, 16-Apr-84 22:59:26 EST Article-I.D.: mcvax.5781 Posted: Mon Apr 16 22:59:26 1984 Date-Received: Wed, 18-Apr-84 19:01:12 EST References: <2310@ecsvax.UUCP> Organization: "Stamp Out Basic" Committee, CWI, Amsterdam Lines: 21 bet@ecsvax.UUCP (Bennett Todd) says: >What we have here is a type conversion problem. >[...] When i *= f is evaluated, the right side of the assignment >operator is evaluated, just as before: it is the float. It is then converted >to integer for the assignment operation: 0.2 goes to 0 in any reasonable >conversion. BEWARE incautious mixed types: they ALWAYS ALWAYS ALWAYS bite >back. NO, NO, NO! This subject has been beaten to death (in this newsgroup or in net.unix-wizards?) a few months ago. It is a definite compiler bug, which unfortunately lingers around in almost all compilers available. This makes the last quoted phrase understandable, but it's the compilers, not the language that bites. Compilers can be fixed. (BTW, look in K&R: somewhere it says a *= b is treated as a = a*b except for the side effects of computing a's address.) -- Guido van Rossum, "Stamp Out Basic" Committee, CWI, Amsterdam guido @ mcvax