From a4dbb5c58270959884c17d720185da06464fa256 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 2 May 2018 08:50:36 +0100 Subject: Prefer static_cast to reinterpret_cast (#4223) * Change reinterpret_cast -> static_cast wherever possible * Remove more unnecessary `const_cast`s. reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there. --- src/Bindings/LuaState.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Bindings/LuaState.cpp') diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 6b620a1f1..0a7579ed8 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -305,7 +305,7 @@ void cLuaState::cTrackedRef::Invalidate(void) if (!m_Ref.IsValid()) { LOGD("%s: Inconsistent callback at %p, has a CS but an invalid Ref. This should not happen", - __FUNCTION__, reinterpret_cast(this) + __FUNCTION__, static_cast(this) ); return; } @@ -2391,7 +2391,7 @@ void cLuaState::TrackRef(cTrackedRef & a_Ref) auto canonState = QueryCanonLuaState(); if (canonState == nullptr) { - LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast(m_LuaState)); + LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast(m_LuaState)); return; } @@ -2410,7 +2410,7 @@ void cLuaState::UntrackRef(cTrackedRef & a_Ref) auto canonState = QueryCanonLuaState(); if (canonState == nullptr) { - LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast(m_LuaState)); + LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast(m_LuaState)); return; } -- cgit v1.2.3