Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2005 12:13:37 +0100
From:      Matthias Andree <matthias.andree@gmx.de>
To:        Michael Sierchio <ducatista@camber-thrust.net>
Cc:        lioux@freebsd.org
Subject:   Re: FreeBSD Port: qmail-1.03_3
Message-ID:  <m3hdl4phni.fsf@merlin.emma.line.org>
In-Reply-To: <20050126104355.GA3837@falcon.midgard.homeip.net> (Erik Trulsson's message of "Wed, 26 Jan 2005 11:43:56 %2B0100")
References:  <41F6F431.6060005@tenebras.com> <1106704507.16118.14.camel@shumai.marcuscom.com> <41F72C02.7060901@camber-thrust.net> <20050126104355.GA3837@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Erik Trulsson <ertr1013@student.uu.se> writes:

> On Tue, Jan 25, 2005 at 09:34:58PM -0800, Michael Sierchio wrote:
>> ( 1 && 0 || 1 ) will ALWAYS evaluate to 1 on any ANSI C compiler.
>
> No, it will evaluate to 0.

It will evaluate to 1, as you're correctly stating...

> && has higher precedence than ||.
>
> (x && y || z) is equivalent to ((x && y) || z)

...here. 1 && 0 || 1 
      ==      0 || 1
      ==           1

(this only holds as the numbers are side-effect free, if x and y were
function calls or macros with side effects, this simplification would
not take the side effects into account)

> which is different from (x && (y || z)).

Exactly.

-- 
Matthias Andree



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m3hdl4phni.fsf>