title: Using an enum as an array index
body: <p>I have this enum:</p>
  
  <pre><code>enum ButtonState {
      BUTTON_NORMAL = 0,
      BUTTON_PRESSED = 1,
      BUTTON_CLICKED = 2
  };
  
  const u8 NUM_BUTTON_STATES = 3;
  </code></pre>
  
  <p>In my Button class I have member variables <code>ButtonState state;</code> and <code>ButtonColors colors[NUM_BUTTON_STATES];</code>. When drawing the button, I use <code>colors[state]</code> to get the colours for whatever state the button is in.</p>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is this good programming style? Is there a better way to do it? (I usually only use enums with switch statements... using an enum as an array index doesn't feel right.)</li>
  <li>Do I <em>have</em> to specify the values of the enum? It seems to start from 0 by default and increment by 1 but is it guaranteed to work that way in all compilers?</li>
  </ol>