title: How to write an 'if' condition that compiles only when DEBUG is #defined?
body: <p>I need some help in writing a macro for 'if-condition' which compiles only when a DEBUG flag is defined by the #define directive.</p>
  
  <p>Here is an example which illustrates what I want. first piece of code shows the usual way of writing an if condition with a #ifdef.</p>
  
  <pre><code>#ifdef DEBUG
  if( rv == false )
  {
       string errorStr = "error in return value" ;
       cout &lt;&lt; errorStr &lt;&lt; endl ;
       throw( Exception(errorStr) ) ;
  }
  </code></pre>
  
  <p>I want to write it in a way similar as below:</p>
  
  <pre><code>DEBUG_IF( rv==false )
  {
       same code as above
  }
  </code></pre>
  
  <p>It seems to be simple but I am having trouble defining a macro which can do this. If someone has experienced this before, kindly help.</p>
  
  <p>Thanks.</p>