[Xorp-hackers] bool SelectorList::Node::is_empty()
Pavlin Radoslavov
pavlin@icir.org
Tue, 25 Oct 2005 10:22:18 -0700
> This function is defined in ~/libxorp/selector.cc:117 as
>
> inline bool
> SelectorList::Node::is_empty()
> {
> return (_mask[SEL_RD_IDX] == _mask[SEL_WR_IDX] == _mask[SEL_EX_IDX] == 0);
> }
>
> Shoudn't the return statement be
>
> return (_mask[SEL_RD_IDX] == 0 && _mask[SEL_WR_IDX] == 0 && _mask[SEL_EX_IDX] == 0);
>
> because i. e. 0 == 1 == 2 == 0 returns true, too?
Yes, this is a bug which is now double-checked with "gmake check"
and is corrected in CVS.
Thanks for the catch!
Pavlin
P.S. I did some "egrep"-bases search for similar bugs, but seems
like there aren't any other.