Re: ignore printf
- From: Rich Webb <bbew.ar@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 18 Dec 2010 07:32:24 -0500
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
ignored..
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
.
- References:
- ignore printf
- From: iC and iC++
- Re: ignore printf
- From: pete
- Re: ignore printf
- From: iC and iC++
- Re: ignore printf
- From: pete
- Re: ignore printf
- From: iC and iC++
- Re: ignore printf
- From: pete
- ignore printf
- Prev by Date: Re: using google from my program
- Next by Date: Re: Views of K Thomson
- Previous by thread: Re: ignore printf
- Next by thread: Re: ignore printf
- Index(es):