*BSD News Article 34603


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!sgiblab!darwin.sura.net!nntp.msstate.edu!olivea!charnel.ecst.csuchico.edu!yeshua.marcam.com!news.kei.com!hookup!news.moneng.mei.com!howland.reston.ans.net!EU.net!Germany.EU.net!news.dfn.de!news.belwue.de!delos.stgt.sub.org!guru.stgt.sub.org!nils
From: nils@guru.stgt.sub.org (Cornelis van der Laan)
Subject: Re: FreeBSD 1.1.5 -- Bug in /usr/bin/leave
Reply-To: nils@ims.uni-stuttgart.de
Sender: news@guru.stgt.sub.org (Cornelis van der Laan)
Nntp-Posting-Host: localhost.ims.uni-stuttgart.de
Organization: Mehr Anarchie !
Message-ID: <NILS.94Aug18045517@guru.stgt.sub.org>
References: <NILS.94Aug14230659@guru.stgt.sub.org> <1994Aug15.034212.20767@cs.brown.edu>
	<NILS.94Aug16025340@guru.stgt.sub.org>
	<1994Aug17.172837.4215@cs.brown.edu>
In-Reply-To: mhw@cs.brown.edu's message of Wed, 17 Aug 1994 17:28:37 GMT
Date: Thu, 18 Aug 1994 02:55:17 GMT
Lines: 34

In article <1994Aug17.172837.4215@cs.brown.edu> mhw@cs.brown.edu (Mark Weaver) writes:
> In article <NILS.94Aug16025340@guru.stgt.sub.org>,
> Cornelis van der Laan <nils@ims.uni-stuttgart.de> wrote:
> >> Your fix doesn't change the program at all.  In C, "&&" has a higher
> >> precedence than "||", and both have a lower precedence than the
> >> comparison operators.  I don't know why you thought this changed
> >> anything, but I'm sure it didn't.
> >
> >You're right, of course. My patch was reversed by some strange
> >mistake. The error in the code is that && has higher precedence over
> >all the preceding || expressions, which it shouldn't have. 
> 
> No, I'm saying that the two versions of the program are EQUIVALENT,
> regardless of which way the patch goes.  Due to the normal precedence of
> operators in C, the parentheses are irrelevant.
> 
> "&&" has higher precedence than "||" in C, even without parentheses.

Sure, 
	  a || b || c && d
is equivalent to
          (a || b || c) && d 
nobody doubts that.
But parenthesis do matter in the expression
	  a || b || (c && d)

Have you tested the program?

Nils.
--
----------------------------------------------------------------
Cornelis van der Laan -- nils@ims.uni-stuttgart.de
                      -- nils@guru.stgt.sub.org
# echo Knusper Knusper Knaeuschen > /etc/nologin