mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
24 lines
925 B
HTML
24 lines
925 B
HTML
<html>
|
|
<body>
|
|
Reports pointless bitwise expressions.
|
|
<p>
|
|
Such expressions include applying the <code>&</code> operator to the maximum value for the given type, applying the
|
|
<code>or</code> operator to zero, and shifting by zero. Such expressions may be the result of automated
|
|
refactorings not followed through to completion and are unlikely to be originally intended.</p>
|
|
<p><b>Examples:</b></p>
|
|
<pre><code>
|
|
// Warning: operation is pointless and can be replaced with just `flags`
|
|
// 0xFFFF_FFFF is the maximum value for an integer, and both literals are treated
|
|
// as 32 bit integer literals.
|
|
int bits = flags & 0xFFFF_FFFF;
|
|
|
|
// Warning: operation is pointless and can be replaced with just `bits`
|
|
// OR-ing with 0 always outputs the other operand.
|
|
int or = bits | 0x0;
|
|
|
|
// Warning: operation is pointless, as always results in 0
|
|
int xor = or ^ or;
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |