
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
39 lines
729 B
Plaintext
39 lines
729 B
Plaintext
== Why is this an issue?
|
|
|
|
Comparing two identical strings will always yield the same result and doesn't achieve anything. This is likely to be made in error.
|
|
|
|
|
|
This rule raises an issue when ``++strcmp++`` or ``++strncmp++`` is called with two identical literal strings or twice the same variable.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
if (strcmp("F00", "F00")) { // Noncompliant
|
|
doSomething();
|
|
}
|
|
if (strncmp(s1, s1, 10)) { // Noncompliant
|
|
doSomethingElse();
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Review this comparison, both strings are identical.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
The full strcmp call
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|