trace.h

来自「一个类似windows」· C头文件 代码 · 共 63 行

H
63
字号
/////////////////////////////////////////////////////////////////////////////
// Diagnostic Trace
//
#ifndef __TRACE_H__
#define __TRACE_H__

#ifdef _DEBUG

#ifdef _X86_
#define BreakPoint()        _asm { int 3h }
#else
#define BreakPoint()        _DebugBreak()
#endif

#ifndef ASSERT
#define ASSERT(exp)                                 \
{                                                   \
    if (!(exp)) {                                   \
        Assert(#exp, __FILE__, __LINE__, NULL);     \
        BreakPoint();                               \
    }                                               \
}                                                   \

#define ASSERTMSG(exp, msg)                         \
{                                                   \
    if (!(exp)) {                                   \
        Assert(#exp, __FILE__, __LINE__, msg);      \
        BreakPoint();                               \
    }                                               \
}
#endif

//=============================================================================
//  MACRO: TRACE()
//=============================================================================

#define TRACE  Trace


#else   // _DEBUG

//=============================================================================
//  Define away MACRO's ASSERT() and TRACE() in non debug builds
//=============================================================================

#ifndef ASSERT
#define ASSERT(exp)
#define ASSERTMSG(exp, msg)
#endif

#define TRACE 0 ? (void)0 : Trace

#endif // !_DEBUG


void Assert(void* assert, const char* file, int line, void* msg);
//void Trace(TCHAR* lpszFormat, ...);
void Trace(char* lpszFormat, ...);


#endif // __TRACE_H__
/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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