DLTcollab / dcurl

Hardware-accelerated Multi-threaded IOTA PoW, drop-in replacement for ccurl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce macro for printing the debug messages

marktwtn opened this issue · comments

Base on the discussion of #143 (comment), the way to print the debug messages should be simplified.
The original code

#if defined(ENABLE_DEBUG)
    printf(......);
#endif

would be replaced with the macro

DPRINTF(...);

The DPRINTF(...) macro implementation is

#if defined(ENABLE_DEBUG)
    #define DPRINTF(...) printf(__VA_ARGS__)
#else
    #define DPRINTF(...)
#endif

It will be written in the src/common.h and allow other dcurl source code to use it.

How about using inline function(s) instead? Compiler optimization can eliminate dead code effectively, and inline functions usually perform more type checking. Messages generated by dprintf can be redirected to internal logging system.