'''Hacking on The Core''' — it's good for the soul! ** Some Debugging Macros ** [PYK] 2015-04-25: I'm still learning the ropes of [C], but I'll throw these here anyway. They came in handy recently to debug an I/O/[thread] issue. ======c #define tdebug(statement) \ fprintf(stderr, "%p: %s\n", Tcl_GetCurrentThread(), (statement)) #define tcdebug(statePtr, statement) \ fprintf(stderr, "%p: chan %s: %s\n", Tcl_GetCurrentThread(), (statePtr)->channelName, (statement)) ====== [AMG]: Minor, minor style tweaks, though the macros look good and useful for situations where you can't use the Tcl I/O or command return mechanisms. The `do ... while (0)` trick is not necessary when the macro is just a single function call. Arguments to be expanded almost always should be surrounded by parentheses, and you do this, but you had `(statePtr->channelName)` rather than `(statePtr)->channelName`. <> The Tcl Core | Debugging