From 4b870cc5f9671201dfad6fa836847cdd40aef519 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 27 Jul 2010 21:31:13 -0400 Subject: Added debug_cast which uses dynamic_cast on debug builds, and static_cast on release builds --- docs/C++CASTING | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/C++CASTING') diff --git a/docs/C++CASTING b/docs/C++CASTING index 5a121a5d1..bae24a24c 100644 --- a/docs/C++CASTING +++ b/docs/C++CASTING @@ -78,6 +78,11 @@ This is safer than C-style casting in that an invalid pointer conversion will return a NULL pointer, and an invalid reference conversion will throw a Bad_cast exception. +Note that in Anope we prefer if Anope::debug_cast is used. +This uses dynamic_cast (and checks for a NULL pointer return) on debug builds +and static_cast on release builds, to speed up the program beacuse of dynamic_cast's +reliance on RTTI. + reinterpret_cast ---------------- -- cgit