46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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
|
|
|
|
[source,javascript]
|
|
----
|
|
if (a & b) { ... } // Noncompliant; & used in error
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
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[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|