// From your browser save this file as text-file named as 'debug.cpp'.
// This file defines the debug_() function which can be used for debugging // the program. It is similar to "C" assert(). The debug_() is set to void() // if DEBUG is not defined in Makefile. This way executable size of production // release is NOT AT ALL effected. Using debug_() very generously has no // impact on production executable size. #ifdef DEBUG #include "debug.h" // Variable value[] can be char, string, int, unsigned long, float, etc... void local_dbg(char name[], char value[], char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %s\n", fname, lineno, name, value ); } void local_dbg(char name[], int value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], unsigned int value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], long value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], unsigned long value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], short value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], unsigned short value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %d\n", fname, lineno, name, value ); } void local_dbg(char name[], float value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %f\n", fname, lineno, name, value ); } void local_dbg(char name[], double value, char fname[], int lineno, bool logfile) { printf("\nDebug %s Line: %d %s is = %f\n", fname, lineno, name, value ); } // You add many more here - value can be a class, ENUM, datetime, etc... #endif // DEBUG