Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assign value is garbage or undefined

I have posted screenshot of my error code. enter image description here

heights output

enter image description here

please any one can help me?

like image 539
Romit M. Avatar asked Mar 14 '13 10:03

Romit M.


1 Answers

I think the static analyzer is not seeing how _numberOfColumns can become non-zero, and hence its insistence that garbage is being assigned. You need to check that you are actually providing some means for _numberOfColumns to become non-zero.

Generally when I am writing loops that want to find the largest or the smallest value, I initialize the size variable to the largest (if I want the smallest) or smallest (if I want the largest) amount, and I think this will solve most of your issues:

float shortestHeight = FLT_MAX;
for (unsigned i = 0; i < _numberOfColumns; i++)
{
    // etc.
}
like image 113
trojanfoe Avatar answered Sep 28 '22 04:09

trojanfoe