NEURON
nrnassrt.h
Go to the documentation of this file.
1 #pragma once
2 
3 /* nrn_assert is not deactivated by -DNDEBUG. Use when the assert expression
4 has side effects which need to be executed regardles of NDEBUG.
5 */
6 
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 
11 #if defined(hocassrt_h) /* hoc_execerror form */
12 #include "oc_ansi.h"
13 
14 #define nrn_assert(ex) \
15  do { \
16  if (!(ex)) { \
17  fprintf(stderr, "Assertion failed: file %s, line %d\n", __FILE__, __LINE__); \
18  hoc_execerror(#ex, nullptr); \
19  } \
20  } while (0)
21 #else /* abort form */
22 #define nrn_assert(ex) \
23  do { \
24  if (!(ex)) { \
25  fprintf(stderr, "Assertion failed: file %s, line %d\n", __FILE__, __LINE__); \
26  abort(); \
27  } \
28  } while (0)
29 #endif
HOC interpreter function declarations (included by hocdec.h)