Variadic macros

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

      Print debugging in the development stage of our testing is inevitable, and the need to remove the print information in the generated release version,

We can use conditional compilation method to solve this problem, the specific methods are as follows:

#ifndef DEBUG_2012_06_06

#define DEBUG_2012_06_06

#endif

#ifdef DEBUG_2012_06_06

#define myPrint(str, ...) {\

      printf(str, ##__VA_ARGS__);\

}

#else

#define myPrint(str, ...)

#endif

So we in the print output places using our own myPrint macro is uses the printf function to use,

In the generation of release version is as long as the note #define DEBUG_2012_06_06 can remove all our print information, wonderful´╝ü

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Ariel at November 14, 2013 - 7:27 AM