title: #ifdef DEBUG versus #if DEBUG
body: <p>It is unclear to me when using compiler directives which of the below two code snippets is correct/preferred and why. It seems that most developers and Open Source projects I've seen use the first but I have seen the second used frequently as well.</p>
  
  <pre><code>#ifdef DEBUG
  [self doSomethingOnlyWhenDebugging];
  #endif
  </code></pre>
  
  <p>VERSUS</p>
  
  <pre><code>#if DEBUG
  [self doSomethingOnlyWhenDebugging];
  #endif
  </code></pre>
  
  <p>Which of the above code snippets is preferable for running code only while debugging and why? My guess is that the first will run if DEBUG is defined as TRUE or FALSE where the second will run only if DEBUG is defined and set to TRUE. Is that correct?</p>