Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site ttrdc.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!mgnetp!ltuxa!ttrdc!levy
From: levy@ttrdc.UUCP (Daniel R. Levy)
Newsgroups: net.lang.c
Subject: Re: && and || *are* left to right
Message-ID: <540@ttrdc.UUCP>
Date: Wed, 30-Oct-85 20:55:19 EST
Article-I.D.: ttrdc.540
Posted: Wed Oct 30 20:55:19 1985
Date-Received: Sat, 2-Nov-85 01:45:23 EST
References: <1556@brl-tgr> <2600023@ccvaxa> <259@3comvax.UUCP> <538@ttrdc.UUCP> <757@whuxl.UUCP>
Organization: AT&T, Computer Systems Division, Skokie, IL
Lines: 24

In article <757@whuxl.UUCP>, mike@whuxl.UUCP (BALDWIN) writes:
>>                                                           The && operator
>> doesn't GUARANTEE the chronological order of evaluation is going to be left
>> to right, if you have a screwball compiler (though it most probably will be).
>>						[dan levy] (that's me)
>
>I have to disagree with this.  && and || are guaranteed to be left to right
>just as much as (1 && 1) is guaranteed to return true.  This is a very
>important feature of C and makes tests like
>	if (x != NULL && strcmp(x, "foo"))
>reasonable.  If there are compilers out there that don't do && and || left
>to right, then they are broken.  I'm not going to rewrite conditionals like
>that example (as nested ifs!) to accomodate *broken* compilers!
>	In C, && and || ARE GUARANTEED to be evaluated left to right!!
>						Michael Baldwin
>						{at&t}!whuxl!mike
I stand corrected.
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!ihnp4!ttrdc!levy