title: C Preprocessor and enums – mistake in my code?
body: <p>I have the following code in a global header, so I can make decisions at compile time:</p>
  
  <pre><code>enum {
      MyStyleA,
      MyStyleB,
      MyStyleC
  };
  
  #define STYLE MyStyleB
  </code></pre>
  
  <p>In various source files, I include this header and do something like this:</p>
  
  <pre><code>#if STYLE == MyStyleC
      doSomething();
  #endif
  </code></pre>
  
  <p>Problem is, <code>doSomething()</code> definitely gets executed even though I defined <code>STYLE</code> to <code>MyStyleB</code> in the header!</p>
  
  <p>Any idea what's going wrong here?</p>
  
  <p>(I admit I am no <strong>C</strong> preprocessor expert.)</p>