delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/09/20:39:25

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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 07 Aug 1997 21:14:48 -0700, Erik Max Francis <max AT alcyone DOT com>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019