1
0
Fork 0

Namespace qualify std::abs, use explicit cast

Without 'std' namespace qualification Clang (at least Apple Clang 6.1)
seems to resolve 'abs' to the 'abs' function in 'cstdlib'.  This in turn
triggers the 'absolute-value' warning which in turn is promoted to
error.

Implicit casts trigger 'old-style-cast' warnings which are promoted to
errors.
This commit is contained in:
Matti Hänninen 2015-08-21 23:37:11 +03:00
parent a341419b04
commit 12fb95ba2f
1 changed files with 1 additions and 1 deletions

View File

@ -2124,7 +2124,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIs
else if (a_DeltaPos.y < 0.0)
{
// Increment statistic
m_Stats.AddValue(statDistFallen, (StatValue)(abs(a_DeltaPos.y) * 100 + 0.5));
m_Stats.AddValue(statDistFallen, static_cast<StatValue>(std::abs(a_DeltaPos.y) * 100 + 0.5));
}
// TODO: good opportunity to detect illegal flight (check for falling tho)
}