rspec/rules/S5286/rule.adoc
Arseniy Zaostrovnykh 7ca29f686f Force linebreaks
2021-02-02 15:02:10 +01:00

28 lines
481 B
Plaintext

Implicit casts which do not make sense are likely to be programming errors.
The rule reports an issue for the following implicit casts:
* Boolean to pointer
* Float to boolean
* ``++nullptr++`` constant to integer
== Noncompliant Code Example
----
float f();
bool test() {
int* j = false; // Noncompliant
bool b = f(); // Noncompliant
if (b) {
return j; // Compliant, pointer to bool
} else {
return nullptr; // Noncompliant, just return false
}
}
----