delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/13/21:19:55

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] expression evaluation order
Date: Sun, 10 Aug 1997 00:49:51 -0700
Organization: Alcyone Systems
Lines: 21
Message-ID: <33ED729F.358C912C@alcyone.com>
References: <5sbb1h$kvr$1 AT newton DOT pacific DOT net DOT sg> <Pine DOT HPP DOT 3 DOT 90 DOT 970807153336 DOT 3441A-100000 AT taltta DOT lpr DOT carel DOT fi>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Teemu Ikonen wrote:

> > Is it safe to assume that the expression
> >
> > if(first_function()==OK && second_function()==OK &&
> > third_function()==OK) return(OK);
> >
> > will be evaluated from left to right?
> 
>  Theoretically no, in practise it could work.

The && operator is _guaranteed_ to be short circuiting since the days of
traditional C.  Please don't add confusion to an otherwise simple issue.

-- 
       Erik Max Francis, &tSftDotIotE / email / mailto:max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
   "Love is not love which alters / when it alteration finds."
                                 / William Shakespeare, _Sonnets_, 116

- Raw text -


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