iceassert.h

来自「使用stl技术,(还没看,是听说的)」· C头文件 代码 · 共 49 行

H
49
字号
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Contains custom assertion code.
 *	\file		IceAssert.h
 *	\author		Pierre Terdiman
 *	\date		January, 14, 2001
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef __ICEASSERT_H__
#define __ICEASSERT_H__

// Leave the {} so that you can write this kind of things safely in release mode:
//	if(condition)	ASSERT()

#ifndef ASSERT
	#if defined( _DEBUG )
		FUNCTION ICECORE_API bool CustomAssertFunction(int, char*, int, char*, bool&);

		//! Custom ASSERT function. Various usages:
		//! ASSERT(condition)
		//! ASSERT(!"Not implemented")
		//! ASSERT(condition && "error text")
		#define ASSERT(exp)																		\
		{																						\
			static bool IgnoreAlways = false;													\
			if(!IgnoreAlways)																	\
			{																					\
				if(CustomAssertFunction((int)(exp), #exp, __LINE__, __FILE__, IgnoreAlways))	\
				{																				\
					_asm { int 3 }																\
				}																				\
			}																					\
		}
	#else
		#define ASSERT(exp)	{}
	#endif
#endif

#ifndef assert
	#define assert	ASSERT
#endif

	#define ICE_COMPILE_TIME_ASSERT(exp)	extern char ICE_Dummy[ (exp) ? 1 : -1 ]

#endif // __ICEASSERT_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?