FreeBSD Port: qmail-1.03_3

Matthias Andree matthias.andree at gmx.de
Wed Jan 26 03:13:43 PST 2005


Erik Trulsson <ertr1013 at 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


More information about the freebsd-ports mailing list