You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
//+---------------------------------------------------------------------------
|
|
//
|
|
// Microsoft Windows
|
|
// Copyright (C) Microsoft Corporation, 1997.
|
|
//
|
|
// File: myassert.hxx
|
|
//
|
|
// Contents: Simple assert code
|
|
//
|
|
// Classes:
|
|
//
|
|
// Functions:
|
|
//
|
|
// Coupling:
|
|
//
|
|
// Notes:
|
|
//
|
|
// History: 9-18-1997 benl Created
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#ifndef _CMYASSERT
|
|
#define _CMYASSERT
|
|
#endif
|
|
|
|
#include <winbase.h>
|
|
|
|
|
|
#ifdef MY_ASSERTS
|
|
#define MYASSERT(cond) \
|
|
if (!(cond)) \
|
|
{ \
|
|
CHAR buffer[1024]; \
|
|
_snprintf(buffer, 1024, "Assert in %s at line %d: %s\n", \
|
|
__FILE__, __LINE__, #cond); \
|
|
if (IsDebuggerPresent()) \
|
|
{ \
|
|
OutputDebugStringA(buffer); \
|
|
DebugBreak(); \
|
|
} \
|
|
fprintf(stderr, buffer); \
|
|
::ExitProcess(2); \
|
|
}
|
|
#else
|
|
#define MYASSERT(cond)
|
|
#endif
|