From: Michal Sojka Date: Wed, 26 Sep 2018 21:39:10 +0000 (+0200) Subject: Add PRINT macro to temporarily print a value of an expression X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hercules2020/kcf.git/commitdiff_plain/9262e6dd525ae89e082fa62084838b9ae493bafa Add PRINT macro to temporarily print a value of an expression --- diff --git a/src/debug.h b/src/debug.h index c9a3b94..25e3943 100644 --- a/src/debug.h +++ b/src/debug.h @@ -71,10 +71,10 @@ class DbgTracer { }; template - void traceVal(const char *name, const T& obj, int line) + void traceVal(const char *name, const T& obj, int line, bool always = false) { (void)line; - if (debug) + if (debug || always) std::cerr << indent() << name /*<< " @" << line */ << " " << print(obj) << std::endl; } @@ -127,5 +127,6 @@ extern DbgTracer __dbgTracer; #define DEBUG_PRINT(obj) __dbgTracer.traceVal(#obj, (obj), __LINE__) #define DEBUG_PRINTM(obj) DEBUG_PRINT(obj) +#define PRINT(obj) __dbgTracer.traceVal(#obj, (obj), __LINE__, true) #endif // DEBUG_H