From 3a874ee7c0486405e4b74fb8019b7567b932dc69 Mon Sep 17 00:00:00 2001 From: Alex Marsev Date: Wed, 27 Jan 2016 13:25:19 +0300 Subject: Replace DebugOut() helper function with macro Ugly, but can't be helped. It's the only way to never evaluate the arguments in release builds. --- src/Utils.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Utils.h b/src/Utils.h index c2fa1fc..053eda3 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -99,9 +99,8 @@ namespace SaneAudioRenderer } template - inline void DebugOut(T&&... args) + inline void DebugOutBody(T&&... args) { - #ifndef NDEBUG try { std::wostringstream stream; @@ -114,9 +113,14 @@ namespace SaneAudioRenderer { OutputDebugString(L"sanear: caught exception while formatting debug message"); } - #endif } + #ifndef NDEBUG + # define DebugOut(...) DebugOutBody(##__VA_ARGS__) + #else + # define DebugOut(...) + #endif + template inline const char* ClassName(T* p) { -- cgit v1.2.3