IdempotentOperations – Warnung bei idempotenten Operationen
Nach oben zu C++-Audits
Beschreibung
IdempotentOperations prüft auf idempotente und tautologische Operationen.
Die folgende Tabelle enthält einige idempotente oder tautologische Operationen:
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 |