title: Why no warning with "#if X" when X undefined?
body: <p>I occasionally write code something like this:</p>
  
  <pre><code>// file1.cpp
  #define DO_THIS 1
  
  #if DO_THIS
      // stuff
  #endif
  </code></pre>
  
  <p>During the code development I may switch the definition of <code>DO_THIS</code> between 0 and 1.</p>
  
  <p>Recently I had to rearrange my source code and copy some code from one file to another. But I found that I had made a mistake and the two parts had become separated like so:</p>
  
  <pre><code>// file1.cpp
  #define DO_THIS 1
  </code></pre>
  
  <p>and</p>
  
  <pre><code>// file2.cpp
  #if DO_THIS
      // stuff
  #endif
  </code></pre>
  
  <p>Obviously I fixed the error, but then thought to myself, why didn't the compiler warn me? I have the warning level set to 4. Why isn't <code>#if X</code> suspicious when X is not defined?</p>
  
  <p>One more question: is there any systematic way I could find out if I've made the same mistake elsewhere? The project is huge.</p>
  
  <p>EDIT: I can understand having no warning with #ifdef that makes perfect sense. But surely #if is different.</p>