Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and &

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Julia Lawall
Date: Wednesday, March 5, 2008 - 5:35 am

On Wed, 5 Mar 2008, Ingo Molnar wrote:


!fn1() && !fn2() does not have the same semantics as !fn1() & !fn2().  In
!fn1() & !fn2() both function calls are evaluated.  In !fn1() && !fn2(),
if !fn1() returns false then !fn2() is not evaluated.  I haven't studied
the particular instances of fn2(), though, to know whether it makes a
difference.

One could instead do something like:

x = fn1();
y = fn2();
if (!x && !y) ...

It would certainly be clearer, but more verbose.

julia

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: C ..., Julia Lawall, (Wed Mar 5, 5:35 am)