|
Boost Users : |
Subject: Re: [Boost-users] Boost.Log formal review upcoming
From: Eric J. Holtman (eric_at_[hidden])
Date: 2010-03-01 11:47:04
Roland Bock wrote:
>
>
> If the respective parts were header only, I wonder if the same could
> not be done without the MACROS (but with compiler optimization).
>
No. If you have a line like
log (level) << Some_Expression ();
there's no compiler optimization (well, probably no optimization)
that can prevent Some_Expression() from being evaluated.
But the macro expands to something along the lines of
if (log.is_filtered (level)) {} else log.streamer ()
so if the line can get trivially filtered, Some_Expression (in the
else clause) never gets evaluated.
Assuming the filtering is fast enough, this allows you to leave
TRACE level logging in a production build, and only turn
it on when you really want it.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net