'debug' Tag

  • fev
    28
    2010

    Simple C macro for debugging

    A little trick if you use printf to debug information in your code and don’t like to comment/uncomment.

    #include <stdio.h>
     
    #define dprintf if (debug) printf
     
    const char debug = 1; /* or 0 if you want disable debug */
     
    int main(int argc, char *argv[] ) {
    dprintf ("debug message");
    return [...]