Closed cugone closed 2 years ago
I compile all projects in Warning Level 4 with treat warnings as errors turned on. The following function returns a warning as an error where the variable length is initialized but never used.
length
void b2DistanceJoint::Draw(b2Draw* draw) const { const b2Transform& xfA = m_bodyA->GetTransform(); const b2Transform& xfB = m_bodyB->GetTransform(); b2Vec2 pA = b2Mul(xfA, m_localAnchorA); b2Vec2 pB = b2Mul(xfB, m_localAnchorB); b2Vec2 axis = pB - pA; //`length` variable is initialized but never used! float length = axis.Normalize(); b2Color c1(0.7f, 0.7f, 0.7f); b2Color c2(0.3f, 0.9f, 0.3f); b2Color c3(0.9f, 0.3f, 0.3f); b2Color c4(0.4f, 0.4f, 0.4f); draw->DrawSegment(pA, pB, c4); b2Vec2 pRest = pA + m_length * axis; draw->DrawPoint(pRest, 8.0f, c1); if (m_minLength != m_maxLength) { if (m_minLength > b2_linearSlop) { b2Vec2 pMin = pA + m_minLength * axis; draw->DrawPoint(pMin, 4.0f, c2); } if (m_maxLength < FLT_MAX) { b2Vec2 pMax = pA + m_maxLength * axis; draw->DrawPoint(pMax, 4.0f, c3); } } }
I compile all projects in Warning Level 4 with treat warnings as errors turned on. The following function returns a warning as an error where the variable
length
is initialized but never used.