title: Advantage of switch over if-else statement
body: <p>What's the best practice for using a <code>switch</code> statement vs using an <code>if</code> statement for 30 <code>unsigned</code> enumerations where about 10 have an expected action (that presently is the same action). Performance and space need to be considered but are not critical.  I've abstracted the snippet so don't hate me for the naming conventions.</p>
  
  <p><code>switch</code> statement:</p>
  
  <pre><code>// numError is an error enumeration type, with 0 being the non-error case
  // fire_special_event() is a stub method for the shared processing
  
  switch (numError)
  {  
    case ERROR_01 :  // intentional fall-through
    case ERROR_07 :  // intentional fall-through
    case ERROR_0A :  // intentional fall-through
    case ERROR_10 :  // intentional fall-through
    case ERROR_15 :  // intentional fall-through
    case ERROR_16 :  // intentional fall-through
    case ERROR_20 :
    {
       fire_special_event();
    }
    break;
  
    default:
    {
      // error codes that require no additional action
    }
    break;       
  }
  </code></pre>
  
  <p><code>if</code> statement:</p>
  
  <pre><code>if ((ERROR_01 == numError)  ||
      (ERROR_07 == numError)  ||
      (ERROR_0A == numError)  || 
      (ERROR_10 == numError)  ||
      (ERROR_15 == numError)  ||
      (ERROR_16 == numError)  ||
      (ERROR_20 == numError))
  {
    fire_special_event();
  }
  </code></pre>