While working with bitwise operators `&`

or `|`

, it is easy to make a typo and write the equivalent logical
operators `&&`

or `||`

. This rule raises an issue when the right operand of a logical expression `&&`

or `||`

is a constant of integral type, as the developer probably meant to use the corresponding bitwise operator `&`

or
`|`

.

### Noncompliant code example

int fun(int a) {
return a || 4; // Noncompliant: did you mean to use bitwise operator '|'?
}

### Compliant solution

int fun(int a) {
return a | 4;
}