From: Chris Uzdavinis (chris_at_[hidden])
Date: 2004-10-22 11:11:37
Rene Rivera <grafik.list_at_[hidden]> writes:
> It's possible without macros for some compilers using careful template
> For example the very simple logger I wrote uses syntax like so (and
> yes I prefer printf formatting :-)...
> "RevisionControl::commit_; wait for ticket #%d",ticket);
> Because the formatting is done by the trace call, and the trace call
> is empty (and inlined) when the log is disabled, no formatting takes
> place. Something similar can be done regardless of what the formatting
> object is by having a specialization that does nothing.
That does not eliminiate any overhead that may exist due to evaluating
the function arguments prior to making the call, nor any potential
side effects of those expressions.
Personally, having debugging log statements completely disappear from
the source code in a release build is more comforting, even if it
involves a macro.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk