
On Fri, 29 Oct 2004 13:26:34 +0400, Maxim Yegorushkin <e-maxim@yandex.ru> wrote:
Daniel Frey <daniel.frey@aixigo.de> wrote:
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.
Well, that is true, though my logging needs has never required calling any expensive functions.
All of the iostreams functions add up fast. Its a huge win to not have to evaluate them if you're not going to log the message. Its a must-have feature. -- Caleb Epstein caleb.epstein@gmail.com