19 lines
337 B
Plaintext
19 lines
337 B
Plaintext
----
|
|
int a;
|
|
class A
|
|
{
|
|
public:
|
|
A();
|
|
private:
|
|
int _b;
|
|
};
|
|
|
|
A::A()
|
|
{
|
|
_b=a; //Noncompliant
|
|
}
|
|
----
|
|
|
|
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
|
|
|