52 lines
860 B
Plaintext
52 lines
860 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
if ( a == a ) // always true
|
|
{
|
|
doZ();
|
|
}
|
|
if ( a != a ) // always false
|
|
{
|
|
doY();
|
|
}
|
|
if ( a == b && a == b ) // if the first one is true, the second one is too
|
|
{
|
|
doX();
|
|
}
|
|
if ( a == b || a == b ) // if the first one is true, the second one is too
|
|
{
|
|
doW();
|
|
}
|
|
|
|
int j = 5 / 5; //always 1
|
|
int k = 5 - 5; // always 0
|
|
|
|
c.Equals(c); //always true
|
|
Object.Equals(c, c); //always true
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
This rule ignores ``++*++``, ``+``, ``++=++``, ``++<<++``, and ``++>>++``.
|
|
|
|
include::../see.adoc[]
|
|
|
|
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[]
|