Skip to content

Instantly share code, notes, and snippets.

@yamamaya
Last active May 4, 2021 03:58
Show Gist options
  • Save yamamaya/26423b0f5d5182d73e4fc90a015e4659 to your computer and use it in GitHub Desktop.
Save yamamaya/26423b0f5d5182d73e4fc90a015e4659 to your computer and use it in GitHub Desktop.
Macro to turn on/off the debug code
#define DEBUGMODE
#ifdef DEBUGMODE
#define DEBUG(x) _DEBUG(,x)
#define _DEBUG(dummy,x) dummy##x
#else
#define DEBUG(x)
#endif
void func( void ) {
DEBUG( printf( "debug message\n" ) );
DEBUG(
printf( "more " );
printf( "debug message\n" );
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment