NEURON
nrnassrt.h
Go to the documentation of this file.
1 #ifndef nrnassrt_h
2 #define nrnassrt_h
3 
4 /* nrn_assert is not deactivated by -DNDEBUG. Use when the assert expression
5 has side effects which need to be executed regardles of NDEBUG.
6 */
7 
8 
9 #include <stdio.h>
10 #include <stdlib.h>
11 
12 #if defined(hocassrt_h) /* hoc_execerror form */
13 
14 #if defined(__cplusplus)
15 extern "C" {
16 #endif
17 
18 extern void hoc_execerror(const char*, const char*);
19 
20 #if defined(__cplusplus)
21 }
22 #endif
23 
24 # if defined(__STDC__)
25 # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}}
26 # else
27 # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror("ex", (char *)0);}}
28 # endif
29 
30 #else /* abort form */
31 
32 # if defined(__STDC__)
33 # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__); abort();}}
34 # else
35 # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__); abort();}}
36 # endif
37 
38 #endif
39 
40 
41 #endif
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:741