|
From: Robert C. <r.c...@gs...> - 2007-10-16 10:40:39
|
I have quite a lot of functions in which I pass a pointer to a structure at first uninitialised that I then initialise within the function. I use the return value of the function to indicate whether the process was successful, I then wrap the function call in an if() to exit if the function wasn't successful. However Valgrind seems to see this as a test of an uninitialised variable, which is isn't, because the function is evaluated before the condition. This results in me having a very large number of errors of this sort: Conditional jump or move depends on uninitialised value(s) is there a reason why it doesn't see this, is it just too in depth to expect or have I misunderstood something? This is not a criticism of Valgrind, it has already proved very useful to me, just want to understand :-) Also, it seems if you allocate a char array, then fill some of its elements and terminate it properly valgrind gives the same error as above, I understand the logic, as I have not initialised every element. Is there a way to do this without looping over all elements and giving them a value? Many thanks, Rob. |