|
From: Paul P. <ppl...@gm...> - 2007-10-16 14:07:46
|
Robert Cussons wrote:
>I am attempting to do this at the moment using another function that
>gave the same error as the one I mentioned, it seems to come up with no
>complaints from Valgrind (which makes it even less likely it's a
>shortcoming of valgrind), so I'll keep adding to it to make it more and
>more similar and see if I can isolate what's causing the valgrind
>complaints in the other case.
>
One "common" way to return uninitialized data from a function is this:
int fn(int x)
{
int y;
if (x) return 1;
return y; // returns "uninitialized" when x==0
}
Later in the code:
int n = 0;
if (fn(n)) { // VG complains here
Cheers,
|