I am trying to define a macro which includes a pre-processor if-statement that checks the DEBUG state in its body. Essentially, here is what I would like to achieve:
Option 1
#define MY_MACRO  { \
                    #ifdef _DEBUG \
                         MyFunction(); \
                    #endif \
                  }
I know that an alternative implementation is the following:
Option 2
#ifdef _DEBUG
   #define MY_MACRO  MyFunction();
#else
   #define MY_MACRO
#endif
So, I have two questions:
- Is Option 1 above, correctly implemented? If not, what is the right way to do it?
- Is Option 2 always the preferred way to do this?
 
     
     
    