dhkim1027
11/9/2015 - 3:22 AM

Debug Macro From http://stackoverflow.com/questions/1941307/c-debug-print-macros

#define DEBUG 3

#if defined(DEBUG) && DEBUG > 0
 #define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \
    __FILE__, __LINE__, __func__, ##args)
#else
 #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
#endif

int main(int argc, char **args) {
    DEBUG_PRINT("Debugging is enabled.\n");    
    DEBUG_PRINT("Debug level: %d", (int) DEBUG);
}