From: loafman AT gte DOT net (Kenneth Loafman) Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q] expression evaluation order Date: 8 Aug 1997 18:50:59 GMT Organization: Loafman Software Lines: 21 Message-ID: <5sfpqj$rdk$1@gte2.gte.net> References: <5sbb1h$kvr$1 AT newton DOT pacific DOT net DOT sg> <5sd0pd$k66$1 AT gte1 DOT gte DOT net> <33EA9D38 DOT 31561027 AT alcyone DOT com> Reply-To: loafman AT gte DOT net NNTP-Posting-Host: dfw72149.gte.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 07 Aug 1997 21:14:48 -0700, Erik Max Francis wrote: >Kenneth Loafman wrote: > >> Although not guaranteed, most C's stop evaluation once an ORing >> expression >> returns true from one of its expressions. Another potential surprise. > >Where in the world do you get this? ANSI C guarantees short circuiting >for both && and ||. Section 6.3.13: As early as 1978 I knew that && was short circuiting, but I've run across a couple of compilers that did not short circuit the || operation, i.e. A||B could be evaluated in either order. Now these may have been earlier compilers, non-ANSI and all that, but once burned, I remember the problem that burned me and avoid it. ...Kenneth