[Ad-dev] [ADIC] #40: replace debugMsg with a nice macro
ADIC
trac at mcs.anl.gov
Mon Jul 12 17:23:00 CDT 2010
#40: replace debugMsg with a nice macro
-------------------------+--------------------------------------------------
Reporter: utke | Owner:
Type: enhancement | Status: new
Priority: major | Milestone:
Component: Utilities | Version:
Keywords: |
-------------------------+--------------------------------------------------
one of the few things that macros are good for...
part of the problem is stuff like this:
debugMsg(5, "FILE : " + sg->unparseToString());
The argument "FILE : " + sg->unparseToString() is ALWAYS evaluated
regardless of the debug level I specify on the command line.
If you replace this with a nice macro like the openad/f one:
#define DBG_TAG_MACRO(Group,Tag,StreamArgs) \
if (DbgLoggerManager::instance()->isSelected((Group)) &&
DbgLoggerManager::instance()->wantTag((Tag))) { \
std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
DbgLoggerManager::instance()->logDebug(__FILE__,__LINE__,(Group),aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy,(Tag));
\
}
you not only avoid evaluating the arguments but also get automatically
__FILE__ and __LINE__ injected.
Wouldn't that be nice?
--
Ticket URL: <http://trac.mcs.anl.gov/projects/ADIC/ticket/40>
ADIC <http://trac.mcs.anl.gov/projects/ADIC>
ADIC: Automatic Differentiation for C and C++
More information about the Ad-dev
mailing list