behavior of -Wall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

I just stumbled upon the fact that -Wall isn't as reliable in reporting the usage of uninitialized variables as I thought.
Given the following code

int main()
{
unsigned int F;
//unsigned int& G = F;
if (F==0){F++;}
}

g++ tells my, as expected "warning: âFâ is used uninitialized in this function". This is not the case if I uncomment the 4th line, assigning the G alias to F. The same does happen if I declare a function

void foo(unsigned int& F){}

and replace the assignement line with a function call. I do understand, that it would be difficult to follow up all possible aliases of F to rule out the possibility of being non initialized but shouldn't this be a easy enough to detect?

Thanks,
Jochen


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux