ReactOS 0.4.16-dev-320-g3bd9ddc
assert.h
Go to the documentation of this file.
1//
2// assert.h
3//
4
5#ifndef __ASSERT_H
6#define __ASSERT_H
7
8#ifndef _MFC_VER
9#ifdef _WIN32_WCE
10
11#else//_WIN32_WCE
12 #include <assert.h>
13#endif//_WIN32_WCE
14#endif
15
16#ifndef ASSERT
17 #ifdef _DEBUG
18 #include <crtdbg.h>
19 #include <stdio.h> // _snprintf
20 //#ifndef WINVER
21 #ifdef _CONSOLE
22 #define ASSERT(x) if(!(x)){printf("ASSERT FAILURE: (%s) at %s:%i\n", #x, __FILE__, __LINE__); _CrtDbgBreak(); }
23 #else//_CONSOLE/WINVER
24 #define ASSERT(x) if(!(x)){char stmp_assert[1024+1]; _snprintf(stmp_assert,1024,"ASSERT FAILURE: (%s) at %s:%i\n",#x,__FILE__,__LINE__); ::MessageBox(NULL,stmp_assert,"Assertion Failure",MB_OK|MB_ICONSTOP); _CrtDbgBreak(); }
25 #endif//_CONSOLE/WINVER
26 #else//_DEBUG
27 #define ASSERT(x)
28 #endif//_DEBUG
29#endif//ASSERT
30
31#undef VERIFY
32#ifdef _DEBUG
33 #define VERIFY(x) ASSERT(x)
34#else//_DEBUG
35 #define VERIFY(x) x
36#endif//_DEBUG
37
38// code for ASSERTing in Release mode...
39#ifdef RELEASE_ASSERT
40 #undef ASSERT
41 #include <stdio.h>
42 #define ASSERT(x) if ( !(x) ) { char s[1024+1]; _snprintf(s,1024,"ASSERTION FAILURE:\n%s\n\n%s: line %i", #x, __FILE__, __LINE__ ); ::MessageBox(NULL,s,"Assertion Failure",MB_OK|MB_ICONERROR); }
43 #undef VERIFY
44 #define VERIFY ASSERT
45#endif//RELEASE_ASSERT
46
47#endif//__ASSERT_H