Pristine Ack-5.5
[Ack-5.5.git] / modules / src / assert / assert.h
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5 /* $Id: assert.h,v 1.8 1994/06/24 11:07:11 ceriel Exp $ */
6 /*       A S S E R T I O N    M A C R O   D E F I N I T I O N           */
7
8 /* This 'assert' definition can be used in a ,-expression. */
9
10 #ifndef NDEBUG
11 #if __STDC__
12 int _BadAssertion(char *, int, char *);
13 #define assert(exp)     ((void)((exp) || _BadAssertion(__FILE__, __LINE__, #exp)))
14 #else
15 /*      Note: this macro uses parameter substitution inside strings */
16 #define assert(exp)     ((exp) || _BadAssertion(__FILE__, __LINE__, "exp"))
17 #endif
18 #else
19 #if __STDC__
20 #define assert(exp)     ((void)0)
21 #else
22 #define assert(exp)     (0)
23 #endif
24 #endif  /* NDEBUG */