I have a trace() macro I turn on and off with another macro, e.g.
#ifdef TRACE
#define trace(x) trace_val(x, 0)
#else
#define trace(x) 0
#endif
This generates warning: statement with no effect from gcc when I call trace() with TRACE undefined. After a little searching I found that changing
#define trace(x) 0
to
#define trace(x) (void)0
silences the error. My question is: Why? What's the difference?