Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sei.cmu.edu!fs7.ece.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!sa1z+ From: sa1z+@andrew.cmu.edu (Sudheer Apte) Newsgroups: comp.lang.c Subject: Re: Evaluation of if's Message-ID: Date: 14 Jun 91 16:28:36 GMT Organization: Civil Engineering, Carnegie Mellon, Pittsburgh, PA Lines: 21 In-Reply-To: <1991Jun13.184843.508@ulkyvx.bitnet> pgheit01@ulkyvx.bitnet writes: > > [...] AAAAAARRRRRGGGGHHHHH! [...] > > The statement if ((i = 1) == (i = 2)) is valid. ANSI C evaluates > conditions from left to right. *ALWAYS* ANSI C short-circuits a > conditional statement *ALWAYS* (unless you tell it not to) Hmm. Since you'll probably be flamed out of existence for this, I won't bother. (In case you haven't yet figured it out, '==' is not guaranteed anywhere to evaluate left-to-right. Your second example [deleted] doesn't use '==', and is correct.) I just have a suggestion to make to Steve Summit: do you think this is a good question to put in the FAQ? I vote to put it in. Thanks, Sudheer. ---------------- ...{harvard, uunet}!andrew.cmu.edu!sa1z sa1z%andrew.cmu.edu@CARNEGIE