dbg_printf


#1

Is there a reason for which the DBG_PRINTF macro has been defined without the parenthesis for the outputDebugPrintf call (see below)

  #define DBG_PRINTF(dbgprintf)         Logger::outputDebugPrintf dbgprintf;

while the normal DBG macro has them?

  #define DBG(dbgtext)                  Logger::outputDebugString (dbgtext);

It’s no big deal, but this does force one to add a couple of extra parenthesis around the argument of DBG_PRINTF to make it work… am I missing something?


#2

It’s because for a printf, you need multiple arguments, and macros don’t let you do that. So you need to use double-parenths around it, e.g.

DBG_PRINTF (("%d", 1234))

(There might be a more cunning way to write a macro that takes multiple args, but I don’t know of one)