/** * A simple example of logging with macros. */ #include #ifdef DEBUG #define LOG(message) fprintf(stderr, "*** %s ***\n", message); #define LOGI(i) fprintf(stderr, " *** %s = %i ***\n", #i, i); #else #define LOG(message) #define LOGI(i) #endif int main (int argc, char *argv[]) { int i; LOG("starting the for loop"); for (i = 0; i <= argc; i++) { LOGI(i); printf ("argv[%d] = %s\n", i, argv[i]); } // for LOGI(i); LOGI(i*i); LOG("ending the for loop"); } // main