C
chris.fairles
So I took a look at assert.h because I knew it uses -DNDEBUG to turn
off its assert statements but it does some funky stuff that I don't
quite understand. I made my own def's something like:
#ifdef DEBUG_LEVEL_1
#define iprint(expr) printf(#expr " = %d\n", expr)
#else
#define iprint(expr)
#endif
#ifdef DEBUG_LEVEL_2
#define
#define pprint(expr) printf(#expr " = %p\n", (void *)(expr))
#else
#define pprint(expr)
#endif
But it was suggested to me that I use some do { } while(0) method or
((void) 0) instead of just leaving the define's blank. Whats the
general opinion on this? (I looked in c-faq without much luck, maybe a
good q to put in less this is implementation specific).
off its assert statements but it does some funky stuff that I don't
quite understand. I made my own def's something like:
#ifdef DEBUG_LEVEL_1
#define iprint(expr) printf(#expr " = %d\n", expr)
#else
#define iprint(expr)
#endif
#ifdef DEBUG_LEVEL_2
#define
#define pprint(expr) printf(#expr " = %p\n", (void *)(expr))
#else
#define pprint(expr)
#endif
But it was suggested to me that I use some do { } while(0) method or
((void) 0) instead of just leaving the define's blank. Whats the
general opinion on this? (I looked in c-faq without much luck, maybe a
good q to put in less this is implementation specific).