Thanks Heena, your example brought out the point clearly.
Campbell - I am not sure which predicate you were referring to as 'original predicate' because soon after the OP, the expression got changed for rest of thread. If you are referring to
then it was clear to me what this does, so i didn't present it. This will perform a bitwise AND on count and (count+1). If you were referring to the predicate
then, this case is also was clear to me. Due to operator precedence the above would be equivalent to
In this case, if count is odd integer, then the right hand side operand evaluates to 'true'.
If count is an even integer, then the right hand side operand would evaluate to 'false'. In both cases, we have a integer as left side operand and a boolean as right side operand.
So, the compiler gives an error.
In all cases a bitwise AND is performed. I wasn't aware of the fact that & evaluates both operands (no matter what); this became clear after Heena's example.
Thanks all, for bringing out this point. This would make a perfect question on the OCA exam.