title: Enum vs Macro States C++
body: <p>(Question is related to my previous questions <a href="https://stackoverflow.com/questions/3238718/difference-between-const-variable-and-const-type-variable">here</a>, <a href="https://stackoverflow.com/questions/3231481/enum-element-limit">here</a>, <a href="https://stackoverflow.com/questions/3199761/define-bit0-bit1-bit2-etc-without-define">here</a>, and <a href="https://stackoverflow.com/questions/3197913/size-of-define-values">here</a>).</p>
  
  <p>I am maintaining a very old application that was ported years ago from DOS to Windows, but a lot of the old C conventions still carry forward.</p>
  
  <p>The one particular convention is a setBit and clrBit macro:</p>
  
  <pre><code>#ifndef setBit
  #define setBit(word, mask) word |= mask
  #endif
  
  #ifndef clrBit
  #define clrBit(word, mask) word &amp;= ~mask
  #endif
  </code></pre>
  
  <p>I found that I could declare a variable as an enum type and set my variable equal to the one of the enumerated values that are defined.</p>
  
  <pre><code>enum SystemStatus
  {
      SYSTEM_ONLINE                = BIT0,
      SYSTEM_STATUS2               = BIT1,
      SYSTEM_STATUS3               = BIT2,
      SYSTEM_STATUS4               = BIT3
  };
  </code></pre>
  
  <p>With <code>BIT0 = 0x00000001</code>, <code>BIT1 = 0x00000002</code>, etc.</p>
  
  <p><code>SystemStatus    systemStatus;</code></p>
  
  <p><code>systemStatus = SYSTEM_ONLINE</code></p>
  
  <p>In your opinion, is using the setBit and clrBit macros more C like or C++ like - and would it be better to simply declare variables as an enumerated type and get rid of all the old setBit/clrBit stuff?</p>