🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4207

Re: order of execution with && and ||

#4207
From: Mike Rubenstein
Date: Tue, 10 Oct 1995 01:47
14 lines
845 bytes
s9511800@yallara.cs.rmit.edu.au (Simon Harris ) wrote:

>What is the order of execution (resolution) for statements with && and ||?

>E.G. Given the following:

>	if (ptr != (char *) 0 && *ptr == 'a')

>does this get resolved left to right?

Yes.  && (||) guarantees left to right execution and that the second
operand will not be evaluated if the first is zero (nonzero).

Michael M Rubenstein
Technical Details
Message-ID: <45cj8i$red@ixnews3.ix.netcom.com>
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
References: <45bbtn$t8o@goanna.cs.rmit.EDU.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
From: miker3@ix.netcom.com (Mike Rubenstein)
Newsgroups: comp.std.c
Subject: Re: order of execution with && and ||
Date: Tue, 10 Oct 1995 01:47:01 GMT
Organization: Netcom
Message-ID: <45cj8i$red@ixnews3.ix.netcom.com>
References: <45bbtn$t8o@goanna.cs.rmit.EDU.AU>
NNTP-Posting-Host: ix-dc11-06.ix.netcom.com
X-NETCOM-Date: Mon Oct 09  6:45:54 PM PDT 1995
X-Newsreader: Forte Free Agent 1.0.82