Changed: Use static_assert in nlctassert macro if C++0X is supported by compiler

hg/feature/sound
kervala 14 years ago
parent db57bd0c11
commit d8c73a8772

@ -583,7 +583,11 @@ template<class T, class U> inline T type_cast(U o)
/** Compile time assertion
*/
#define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
#ifdef NL_ISO_CPP0X_AVAILABLE
# define nlctassert(cond) static_assert(cond, "Compile time assert in "#cond)
#else
# define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
#endif
/**
* Allow to verify an object was accessed before its destructor call.

@ -117,6 +117,10 @@
# define NL_COMP_GCC
#endif
#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define NL_ISO_CPP0X_AVAILABLE
#endif
// gcc 3.4 introduced ISO C++ with tough template rules
//
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX

@ -113,8 +113,8 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
_TextureIdOver[2].setTexture((TxName+"_r.tga").c_str());
}
// Compute Bmp Sizes (crash with VC++ 2010)
// nlctassert(NumTexture==3);
// Compute Bmp Sizes
nlctassert(NumTexture==3);
rVR.getTextureSizeFromId(_TextureIdNormal[0], _BmpLeftW, _BmpH);
rVR.getTextureSizeFromId(_TextureIdNormal[1], _BmpMiddleW, _BmpH);
rVR.getTextureSizeFromId(_TextureIdNormal[2], _BmpRightW, _BmpH);

Loading…
Cancel
Save