So yet again I'm working through the teach yourself c++ in 21 days and I am stuck again.
This is in regard to different debugging macro levels.
Heres the example...
So depending on what I set DEBUGLEVEL to be should decide what methods I want. As it stands the output always acts as if I'm using HIGH, but if I just use numbers such as...Code:#include <iostream> #include <string.h> using namespace std; enum LEVEL { NONE, LOW, MEDIUM, HIGH }; const int FALSE = 0; const int TRUE = 1; typedef int BOOL; #define DEBUGLEVEL LOW #if DEBUGLEVEL < LOW #define ASSERT(x) #else #define ASSERT(x) \ if (! (x)) \ { \ cout << "ERROR!! Assert " << #x << " failed\n"; \ cout << " on line " << __LINE__ << "\n"; \ cout << " in file " << __FILE__ << "\n"; \ } #endif #if DEBUGLEVEL < MEDIUM #define EVAL(x) #else #define EVAL(x) \ cout << #x << ":\t" << x << endl; #endif #if DEBUGLEVEL < HIGH #define PRINT(x) #else #define PRINT(x) \ cout << x << endl; #endif
it works as expected.Code:#define DEBUGLEVEL 1 #if DEBUGLEVEL < 1
so whats up with the enum LEVEL stuff not working?



LinkBack URL
About LinkBacks



