¡@

Home 

c++ Programming Glossary: debug_enabled

Is this a good way to embed debugging message in my program? (Macros)

http://stackoverflow.com/questions/11480463/is-this-a-good-way-to-embed-debugging-message-in-my-program-macros

uses the compiler's dead code removal #define DEBUG msg if DEBUG_ENABLED else dbglog __FILE__ __LINE__ msg #ifdef DEBUG_FLAG #define.. dbglog __FILE__ __LINE__ msg #ifdef DEBUG_FLAG #define DEBUG_ENABLED 1 #else #define DEBUG_ENABLED 0 #endif The dbglog instance is.. #ifdef DEBUG_FLAG #define DEBUG_ENABLED 1 #else #define DEBUG_ENABLED 0 #endif The dbglog instance is a ostream wrapper that detects..

#ifdef vs #if - which is better/safer as a method for enabling/disabling compilation of particular sections of code?

http://stackoverflow.com/questions/135069/ifdef-vs-if-which-is-better-safer-as-a-method-for-enabling-disabling-compila

I prefer to do the following SomeSourceFile.cpp #define DEBUG_ENABLED 0 ... SomeFunction int someVariable 5 #if DEBUG_ENABLED printf.. DEBUG_ENABLED 0 ... SomeFunction int someVariable 5 #if DEBUG_ENABLED printf Debugging someVariable d someVariable #endif Some of.. team prefer the following though SomeSourceFile.cpp #undef DEBUG_ENABLED #define DEBUG_ENABLED ... SomeFunction int someVariable 5 #ifdef..