IdempotentOperations -- Warn About Idempotent Operations

From RAD Studio
Jump to: navigation, search

Go Up to C++ Audits

Description

IdempotentOperations checks for idempotent and tautological operations.

For example, the following table represent some idempotent or tautological operations:

Operator
x op x 
x op 1 
1 op x 
x op 0 
0 op x 
x op ~0 
~0 op x 
+, += 
x
x
-, -=
x
-x
*, *=
x
x
0
0
/, /=
1
x
N/A
0
 &, &=
x
0
0
x
x
|, |=
x
x
x
~0
~0
 ^, ^= 
0
x
x
<<, <<=
x
0
>>, >>=
x
0
|| 
1
1
1
x
x
1
1
 && 
1
x
x
0
0
x
x
=
x
==
1
>=
1
<=
1
>
0
<
0
!=
0


See Also