Skip to content

Instantly share code, notes, and snippets.

@Jacajack
Last active May 29, 2016 22:08
Show Gist options
  • Save Jacajack/02d72b7eb84a44e29de0ae698a42460d to your computer and use it in GitHub Desktop.
Save Jacajack/02d72b7eb84a44e29de0ae698a42460d to your computer and use it in GitHub Desktop.
Simple C debugging macro
#include <stdio.h>
#ifndef _DEBUG_HEADER
#define _DEBUG_HEADER
#ifndef DEBUG_ENABLED
#define DEBUG_ENABLED 0
#endif
#ifndef DEBUG_OUT
#define DEBUG_OUT printf
#endif
#if DEBUG_ENABLED == 1
#define DEBUG( format, expr ) DEBUG_OUT( "'%s' => '"format"'\n", #expr, ( expr ) )
#else
#define DEBUG( format, expr )
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment