From 12fb95ba2f51d3104b68054ea2f7a1200d21592a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matti=20H=C3=A4nninen?= Date: Fri, 21 Aug 2015 23:37:11 +0300 Subject: [PATCH] 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. --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index b8673420d..910ad4c0e 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -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(std::abs(a_DeltaPos.y) * 100 + 0.5)); } // TODO: good opportunity to detect illegal flight (check for falling tho) }