Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!ut-sally!pyramid!decwrl!sun!guy From: guy@sun.UUCP Newsgroups: net.lang.c Subject: Re: Precedent for use of = Message-ID: <5065@sun.uucp> Date: Sun, 13-Jul-86 15:49:36 EDT Article-I.D.: sun.5065 Posted: Sun Jul 13 15:49:36 1986 Date-Received: Mon, 14-Jul-86 07:26:59 EDT References: <2323@umcp-cs.UUCP> <514@cbmvax.cbmvax.cbm.UUCP> <5057@sun.uucp> <5330@topaz.RUTGERS.EDU> Organization: Sun Microsystems, Inc. Lines: 33 > > If your compiler can't generate equally efficient code for > > > > a = b; > > if (a != 0) > > > > and > > > > if ((a = b) != 0) > > > > on any machine other than an incredibly weird one, then your compiler > > needs to be improved. > > Ideally, degrees of optimization should be available, Yeah, they should, but so what? Why is this relevant to the previous comment? It doesn't say "if your compiler doesn't always generate", it says "if your compiler *can't* generate". The claim that constructs like if ((a = b) != 0) are necessary because they generate more efficient code than a = b; if (a != 0) is bogus; compilers *can* be made to generate equally efficient code for both. The fact that you can write things in the first style should *not* be used as an excuse for compiler writers not to do optimization "because the human will do it for you". -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)