Our code includes a POD (Plain Old Datastructure) structure (this is a basic C ++ structure that has other POD structures and variables that need to be initialized at the beginning.)
Based on what I read , it seems that:
myStruct = (MyStruct*)calloc(1, sizeof(MyStruct));
should initialize all values ββto zero, as well as:
myStruct = new MyStruct();
However, when the structure is initialized in the second way, Valgrind later complains that "conditional branching or movement depends on uninitialized value (s)" when these variables are used. Is my understanding spoiled here, or is Valgrind throwing false positives?
c ++ initialization struct calloc valgrind
Shadow503 May 6 '11 at 16:39 2011-05-06 16:39
source share