Query module BoolValueInBitOp

name
Boolean value in bitwise operation
description
A Boolean value (i.e. something that has been coerced to have a value of either 0 or 1) is used in a bitwise operation. This commonly indicates missing parentheses or mistyping logical operators as bitwise operators.
kind
problem
id
cpp/bool-value-in-bit-op
problem.severity
warning
tags
reliability

Imports

cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

nonShortCircuitLogic2

It’s common in some projects to use “non-short-circuit logic”, i.e. to apply the bitwise and, or and xor operators to Boolean values. Such use, while considered bad practice, is usually not incorrect.

Classes