In our cross-platform c-project we are using the macro for the logging purposes:
#if _WINDOWS
#define DEBUG_PRINTF(x) KdPrint(x)
#endif
The DEBUG_PRINTF usage example:
DEBUG_PRINTF(("Message with param (%s)\n", pString)); // (1)
DEBUG_PRINTF(("Message with no param\n")); // (2)
It is ok. According to the KdPrint function reference a call to KdPrint requires double parentheses:
KdPrint (( Format, arguments ))
KdPrintEx (( DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, Format, arguments ))
My question is how to deal with already existed macros such as (1) and (2) by porting the DEBUG_PRINTF on other platform such as linux in userspace?
For example the definition
#if defined (__LINUX__)
#define DEBUG_PRINTF((x)) fprintf(stderr, x)
#endif
does not compile for macros such as (1).
I would do it the other way around:
Usage: