Description of problem: I just tried to compile kdegraphics-3.4.0-2 from Redhat Fedora Core development tree The compiler said kpcursorlightcross.cpp:75: warning: 'colorValue' is used uninitialized in this function The source code is if (colorValue) I agree with the compiler. Suggest initialise colorValue before first use. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
i have taken a look here. The code looks sane for me! ... int colorValue, maskValue; switch (pv) { case White: colorValue = ColorWhite; maskValue = MaskOpaque; break; case Black: colorValue = ColorBlack; maskValue = MaskOpaque; break; case Transparent: colorValue = ColorWhite; maskValue = MaskTransparent; break; } if (colorValue) ...
>The code looks sane for me! I'm guessing why you think that. Maybe you think that there is default initialisation of local variables to zero in C or maybe that pv can take only one of three values ? In either case, I still strongly recommend initialisation of colorValue *before* the switch statement is evaluated. switch statements have a nasty habit of having none of the cases executed.