Skip to content

Commit 809b3ad

Browse files
committed
use reinterpret_cast to print function pointers
c++ standard does not allow static cast of a function pointer to `void*`
1 parent 4fd76d6 commit 809b3ad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

library/modules/EventManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static const int32_t ticksPerYear = 403200;
7272

7373
void DFHack::EventManager::registerListener(EventType::EventType e, EventHandler handler) {
7474
DEBUG(log).print("registering handler {} from plugin {} for event {}\n",
75-
static_cast<void*>(handler.eventHandler),
75+
reinterpret_cast<void*>(handler.eventHandler),
7676
handler.plugin ? handler.plugin->getName() : "<null>",
7777
static_cast<int>(e));
7878
handlers[e].insert(pair<Plugin*, EventHandler>(handler.plugin, handler));
@@ -91,7 +91,7 @@ int32_t DFHack::EventManager::registerTick(EventHandler handler, int32_t when, b
9191
handler.freq = when;
9292
tickQueue.insert(pair<int32_t, EventHandler>(handler.freq, handler));
9393
DEBUG(log).print("registering handler {} from plugin {} for event TICK\n",
94-
static_cast<void*>(handler.eventHandler),
94+
reinterpret_cast<void*>(handler.eventHandler),
9595
handler.plugin ? handler.plugin->getName() : "<null>");
9696
handlers[EventType::TICK].insert(pair<Plugin*,EventHandler>(handler.plugin,handler));
9797
return when;

0 commit comments

Comments
 (0)