< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] r4478: uninitialized variable usage


On Fri, 29 Apr 2005, Dmitry Semyonov wrote:

> This is obviously a bug:
> 
> sip\resiprocate\helper.cxx(1007) : warning C4700: 
> local variable 'index' used without having been initialized

Sorry, it is not a bug. But the warning is misleading, and the code is 
a bit messy. E.g. in

            if (q == preferredTokens[i]) {
               if (!found || i < index) {
                  found = true;
                  index = i;
               }
               return(q);
            }

second 'if' could be safely removed, since found and index are local 
variables. Also

   if (found)
      return preferredTokens[index];

condition at the end of the function will never hit.

Could the author of the function review it?
TIA

-- 
...Bye..Dmitry.