Last active
May 29, 2016 22:08
-
-
Save Jacajack/02d72b7eb84a44e29de0ae698a42460d to your computer and use it in GitHub Desktop.
Simple C debugging macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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