- Take in account also that pain in the ass that is MSVC++ on win32

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1190 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-16 12:57:03 +00:00
parent f174524b1e
commit 74a2d8ff91
1 changed files with 7 additions and 4 deletions

View File

@ -22,9 +22,7 @@
#ifndef DOWN_CAST_TCC #ifndef DOWN_CAST_TCC
#define DOWN_CAST_TCC 1 #define DOWN_CAST_TCC 1
#include <functional> #if (not defined NDEBUG) && (not defined _MSC_VER)
#ifndef NDEBUG
#include <sys/types.h> #include <sys/types.h>
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
@ -81,6 +79,7 @@ namespace sgpem
inline To& operator()(From& obj) const inline To& operator()(From& obj) const
{ {
#ifndef NDEBUG #ifndef NDEBUG
#ifndef _MSC_VER
try try
{ {
return dynamic_cast<To&>(obj); return dynamic_cast<To&>(obj);
@ -95,6 +94,10 @@ namespace sgpem
kill(me, SIGSTOP); kill(me, SIGSTOP);
throw; throw;
} }
#else
// For MSVC++ on Win32
return dynamic_cast<To&>(obj);
#endif
#else #else
return static_cast<To&>(obj); return static_cast<To&>(obj);
#endif #endif
@ -110,7 +113,7 @@ namespace sgpem
template<typename From> template<typename From>
inline To* operator()(From* obj) const inline To* operator()(From* obj) const
{ {
#ifndef NDEBUG #if (not defined NDEBUG) && (not defined _MSC_VER)
To* check_ptr = dynamic_cast<To*>(obj); To* check_ptr = dynamic_cast<To*>(obj);
if(check_ptr == NULL) if(check_ptr == NULL)
{ {