Re: ignore printf

On Fri, 17 Dec 2010 20:25:49 -0500, pete <pfiland@xxxxxxxxxxxxxx> wrote:

iC and iC++ wrote:

Thanks for clarifying the code further. Someone brought up that this
would be wasting memory space, what are your thoughts on that. I have
enough memory to waste in this case, but I actually thought once the
code is compiled with optimization option, all the statements would be

In solution that I wrote, the MY_ASSERT code disappears
from the translation unit.

In the solution provided by Rich Webb, which I think I like
a little bit better than what I came up with,
the macro code also disappears from the translation unit.

The version that BartC shows, built around

#define dprintf(...) printf(__VA_ARGS__)

is probably the cleanest way to do it, but that capability was only
introduced in the C99 standard (although some compilers would have
supported it before that). The version I showed using the double
parentheses is rather uglier but should be universally available.

Rich Webb Norfolk, VA