I heard a remark about:
we should not treat
!=differently than==
And I agree.
I think we could increase the complexity by +1 for ^ , != and == when at least one of the operand is also a binary expression, when one binary expression combine others:
if ((a < 2) ^ (b < 4))
if ((a < 2) != (b < 4))
if ((a < 2) == (b < 4))
But if no operand is a binary expression, even for boolean operands, I think we should not increase the complexity for == in this case, for example:
if (a == b)
And to be consistent, I think we should not increase the complexity for != and ^ in the same case.
My new proposal is, given a binary operator having boolean operands:
+1for&and|using the same logic than&&and||(consecutive series of the same operator only counts as+1)- +1 for
^,!=and==when at least one operand is also a binary expression (binary expression combination)