RE: proposal for ICU tracing
"Robert Buck" <[email protected]>
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <EFEB6396440FB440ADD8A753B5530B9C0157DC6A@MESSAGE-AH.ad.mathworks.com> |
Sounds great.
> Yes, some configuration option to compile out the tracing stuff is
> planned. But, by default, the tracing code will be present
> in release
> builds. The overhead is a single if(boolean_variable) test
> at the entry
> and exit of traced functions, not too bad.
Plus, it could be coded as:
#ifdef USE_TRACING
static const bool use_tracing = true;
#else
static const bool use_tracing = false;
#endif
// ...
if (use_tracing) {
// ...
}
That way the compiler will always do at least a syntax check on the code in the branch, even if tracing is turned off. And since 'if (use_tracing)' is constant, all compilers will strip the branch out, yielding no overhead, if it results in 'false'.
Bob