www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/02/07:59:54

Message-Id: <199904021259.HAA32513@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: clc5q AT cobra DOT cs DOT Virginia DOT EDU (Clark L. Coleman)
Date: Fri, 2 Apr 1999 13:57:15 +0000
MIME-Version: 1.0
Subject: Re: short circuit evaluation
CC: djgpp AT delorie DOT com
X-mailer: Pegasus Mail for Win32 (v2.42a)
Reply-To: djgpp AT delorie DOT com

On  2 Apr 99 at 1:46, Clark L. Coleman wrote:

> How does this force full evaluation? Shouldn't he try:
> 
> i = f();
> j = g();
> if (i || j)
> 
> 
> wherever he wanted a full evaluation of:
> 
> if (f() || g())

Yes; or, if you don't want to use those variables:

    if ( (f()?1:0) | (g()?1:0) ) ...
    if ( (f()?1:0) & (g()?1:0) ) ...

-- 
George

- Raw text -


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