Added macros for fancy C++ casts.

This commit is contained in:
waterson%netscape.com 1998-12-04 01:13:21 +00:00
parent 45fedef1f0
commit 9ec2d30af9

View File

@ -136,4 +136,22 @@ typedef PRUcs2 PRUnichar;
#define NS_PLUGIN NS_IMPORT
#endif
/* ------------------------------------------------------------------------ */
// Casting macros for hiding C++ features from older compilers
#if defined(HAS_C_PLUS_PLUS_CASTS)
#define NS_STATIC_CAST(__type, __ptr) static_cast<__type>(__ptr)
#define NS_CONST_CAST(__type, __ptr) const_cast<__type>(__ptr)
#define NS_REINTERPRET_CAST(__type, __ptr) reinterpret_cast<__type>(__ptr)
#else
#define NS_STATIC_CAST(__type, __ptr) ((__type)(__ptr))
#define NS_CONST_CAST(__type, __ptr) ((__type)(__ptr))
#define NS_REINTERPRET_CAST(__type, __ptr) ((__type)(__ptr))
#endif
#if defined(HAS_C_PLUS_PLUS_CASTS) && defined(HAS_RTTI)
#define NS_DYNAMIC_CAST(__type, __ptr) dynamic_cast<__type>(__ptr)
#else
#define NS_DYNAMIC_CAST(__type, __ptr) ((__type)(__ptr))
#endif
#endif /* nscore_h___ */