[lkml]   [2001]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: if (a & X || b & ~Y) in dasd.c
At 08:38 PM 11/19/2001 +0100, Peter T. Breuer wrote:

>"bill davidsen wrote:"
> > If the code does what I think it does, it works as written. However, I
> > usually would throw in parenthesis on something like this to be sure
> > that the next person reading the code won't waste time thinking about
>Which is WHY you do not put in parentheses.

<snip snip>

So instead of using extra parentheses, we should include a copy of your
response in every potentially ambiguous location instead?

Two C constructs that have bitten me in the glutinous maximus on more than
one occasion:

mem_address = mem_base + page_index << 12; // Wrong!

if ( bit_mask & BIT_FLAG == 0) { flag_not_set(); } // Wrong!

Of course C has precedence. It's not always obvious. And the difference
between this

x = y + z << 2;


x = (y + z) << 2;

is that the 2nd doesn't make me have to remember the relative precedences
of + and <<.


REAL kernel hackers use
# cat > /vmlinuz
# insmod /dev/stdin

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:13    [W:0.063 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site