Hi,
I have a class A as follows:
class A
{
public:
A()
{
printf("A constructed\n");
}
~A();
//no other constructors/assignment operators
}
I have the following elsewhere
A * _a;
I initalize it with:
int count = ...
...
_a = new A[count];
and I access it with
int key = ....
...
A *a_inst = &(_a[key]);
....
It runs normally, and the printf in the constructor is executed, and all the fields in A are fine.
I ran Valgrind with the following args:
valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./A_app
and Valgrind keeps yelling about
Conditional jump or move depends on uninitialised value(s)
and then the stack trace to the accessors statements.
Can anyone explain why this is happening? Specifically if what Valgrind says is true, why is the constructor executed?