33 lines
901 B
Plaintext
33 lines
901 B
Plaintext
The bitwise operators ``++&++``, ``++|++`` can be mistaken for the boolean operators ``++&&++`` and ``++||++``.
|
|
|
|
|
|
This rule raises an issue when ``++&++`` or ``++|++`` is used in a boolean context.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
if (a & b) { ... } // Noncompliant; & used in error
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
if (a && b) { ... }
|
|
----
|
|
|
|
|
|
== Exceptions
|
|
|
|
When a file contains other bitwise operations, (``++^++``, ``++<<++``, ``++>>>++``, ``++>>++``, ``++~++``, ``++&=++``, ``++^=++``, ``++|=++``, ``++<<=++``, ``++>>=++``, ``++>>>=++`` and ``++&++`` or ``++|++`` used with a numeric literal as the right operand) all issues in the file are ignored, because it is evidence that bitwise operations are truly intended in the file.
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|