Example
void
foo(
int
a,
int
b)
{
if
( a&b != 0 ) {
//b!=0 evaluated first
}
}
Solution
Use brackets to make sure bit-wise operator is evaluated first.
void
foo(
int
a,
int
b)
{
if
( (a&b) != 0 ) {
//(a&b) evaluated first
}
}