]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/TOOLS/BLD/INC/ASSERT.H

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / TOOLS / BLD / INC / ASSERT.H
1 /***
2 *assert.h - define the assert macro
3 *
4 * Copyright (c) 1985-1988, Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * Defines the assert(exp) macro.
8 * [ANSI/System V]
9 *
10 *******************************************************************************/
11
12
13 #ifndef _ASSERT_DEFINED
14
15 #ifndef NDEBUG
16
17 static char _assertstring[] = "Assertion failed: %s, file %s, line %d\n";
18
19 #define assert(exp) { \
20 if (!(exp)) { \
21 fprintf(stderr, _assertstring, #exp, __FILE__, __LINE__); \
22 fflush(stderr); \
23 abort(); \
24 } \
25 }
26
27 #else
28
29 #define assert(exp)
30
31 #endif /* NDEBUG */
32
33 #define _ASSERT_DEFINED
34
35 #endif /* _ASSERT_DEFINED */