rspec/rules/S1245/rule.adoc

19 lines
337 B
Plaintext
Raw Normal View History

----
int a;
class A
{
public:
A();
private:
int _b;
};
A::A()
{
_b=a; //Noncompliant
}
----
2021-01-26 14:30:57 +01:00
The order of initialization of static objects defined in different compilation units is not defined in the {cpp} language definition. Therefore, accessing global data from a constructor may result in reading from uninitialized objects