guy keren wrote:
int i; int j = i; int k = j; if (k > 0) blablabla...
valgrind will only point the last one as an error (at least, that's how it
is in valgrind-1.0.3).
Actually, that's intentional. Otherwise, consider the following example:
struct padding {
char a;
int b;
} struct a, b;.
struct inst1,inst2; inst1.a=0; // Initialize all members of inst1 inst1.b=0; // Or do we?
memcpy(&inst2, &inst1, sizeof(inst1));
If valgrind had not been build like it is, it would complain about the memcpy. Reason being that struct padding (pun intended) has an implicit "char" (or three) between member "a" and member "b", that are obviously not initialized, yet copied by memcpy. What valgrind actually does is copy the "uninitialized" status of these members from inst1 to inst2. If you actually tried to access them:
if((&inst2.a)[1])
printf("what is in here?\n");THEN valgrind can be sure that you have done something wrong, and only then will it complain.
Shachar
-- Shachar Shemesh Lingnu Open Source Consulting ltd. http://www.lingnu.com/
================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
