rspec/rules/S5262/cfamily/rule.adoc

13 lines
327 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Dereferencing a null pointer has undefined behavior, and it is particularly harmful if a reference is then bound to the result, because a reference is assumed to refer to a valid object.
== Noncompliant Code Example
----
void doSomething(A& a);
void f() {
A* a = nullptr;
// ...
doSomething(*a); // Noncompliant
}
----