I have code that I want to have two modes, debug
and verbose
. I define them in my header file as,
#define verbose TRUE
#define debug TRUE
In my code so far, I have just been using
#if(debug)
//code
#endif
but is it more proper to use?
#ifdef debug
// code
#endif
I read something about preprocessor macros but it didn't make sense at the time. So, I have a question: Is #if defined MACRO
equivalent to #ifdef MACRO
? and which one is better for enabling/disabling a particular section of code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…