Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-10-29 05:01:03


>>
>> There is an option for avoiding if() checks in client code at all. All
>> you have to do is to implement operator<< for logger class.
>>
>> [...]
>>
>> And then in client code:
>>
>> logger("app.gui") << "something GUIsh";
>>
>> Though I am not sure, if a compiler will be able to optimize checks
>> for every operator<<() to a single check for the entire output
>> expression.
>
>
> Now replace "something GUIsh" with anExpensiveFunction(). John's code
> will not evaluate it when the logger is disabled. OTOH your code will
> always evaluate it, which is IMHO not acceptable for a logging library.
>
Yes, that's what I want to avoid. Thanks Daniel.

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.5 - tooltips at your fingertips (work for menus too!)
    + bitmap buttons (work for MessageBox too!)
    + tab dialogs, hyper links, lite html

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk