Page 1 of 1

Fixing warnings, klauss a little input please

Posted: Tue Feb 08, 2011 10:30 pm
by pheonixstorm
first,

Code: Select all

..\..\vegastrike\src\gfx\nav\navpath.cpp(462) : warning C4101: 'i' : unreferenced local variable
..\..\vegastrike\src\gfx\nav\navpath.cpp(463) : warning C4101: 'system' : unreferenced local variable
Can both of these be removed? They are part of:

Code: Select all

void NavPath::addNewPath()
{
    NavigationSystem::CachedSystemIterator &systemIter = _Universe->AccessCockpit()->AccessNavSystem()->systemIter;

    int i;
    unsigned system;
    //Inscribe new path
    //*************************

    list< unsigned >::iterator aux;
    for (list< unsigned >::iterator iter = path.begin(); iter != path.end(); ++iter) {
        if ( (*iter) != path.front() )
            pathNeighbors[(*iter)].first = ( *--(aux = iter) );
        if ( (*iter) != path.back() )
            pathNeighbors[(*iter)].second = ( *++(aux = iter) );
        systemIter[*iter].part_of_path = true;
        systemIter[*iter].paths.insert( this );
    }
}
It loos like it can be removed but want a second opinion

Next warning... class/struct mixups fixed. There are several warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
that I don't know how to fix (never come across it so unsure why that wanring is coming up) and several more unreferenced locals. I am attached the build log to see if we can get the rest of these warnings worked out. I used /w3 for this run.

Re: Fixing warnings, klauss a little input please

Posted: Tue Feb 08, 2011 10:34 pm
by klauss
pheonixstorm wrote:first,

Code: Select all

..\..\vegastrike\src\gfx\nav\navpath.cpp(462) : warning C4101: 'i' : unreferenced local variable
..\..\vegastrike\src\gfx\nav\navpath.cpp(463) : warning C4101: 'system' : unreferenced local variable
Can both of these be removed?
I believe so too.

Re: Fixing warnings, klauss a little input please

Posted: Tue Feb 08, 2011 10:40 pm
by klauss
pheonixstorm wrote: Next warning... class/struct mixups fixed. There are several warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
It's telling you a boolean value (ie, any numeric value) is being cast into a "bool" variable, which requires, per C spec, the equivalent of (expression != 0) ? 1 : 0. It's "slow".

I wouldn't pay much attention, the way around the warning is to explicitly do the casting.

Re: Fixing warnings, klauss a little input please

Posted: Tue Feb 08, 2011 10:50 pm
by pheonixstorm
Thats fine. The svn project file runs with w1 so none of these warnings show up. Im mostly trying to fix any that conflict such as declaring struct something then in another file declaring the same struct as a class and things that might eventually go boom or just got missed on some cleanup such as unreferenced variables.