Lars Gullik BjÃnnes wrote:

> | i.e. !(a && b) == (!a || !b)
> 
> Is it?
> 
>    a - pit is first par
>    b - rit is first row
> 
>    !a && !b   -> !(a || b)

But this is not what we have: we have to replace all "b" in the old code by
"a && b". So when you have !b you get !(a && b) i.e. (!a || !b).

This check works fine: b will only be checked if !a is *false*, i.e. if a is
true, i.e. if pit is the first par.

> remember that && and || is shortcur and why a was added was to avoid
> the evaluation of b.

Sure.

> so in !(a || b)
> 
> a is false then b is tested -> error

I don't propose this, but !(a && b)
 
> with (!a && !b)
> 
> a is false (thus true) and b is never tested.

[I interpret this as: "a is false, (thus !a true) and..."]

This is wrong IMO: if !a is true, the whole expression has to be tested.

> I guess the (!a && !b) -> !(a || b) transmformation only holds if a
> and b are independant. That is not the case here.

C'mon! this holds in every case (modulo drunkness ;-).

Alfredo


Reply via email to