title: Comparing enums to integers
body: <p>I've read that you shouldn't trust on the underlying implementation of an enum on being either signed or unsigned. From this I have concluded that you should always cast the enum value to the type that it's being compared against. Like this:</p>
  
  <pre><code>enum MyEnum { MY_ENUM_VALUE = 0 };
  
  int i = 1;
  if (i &gt; static_cast&lt;int&gt;(MY_ENUM_VALUE))
  {
      // do stuff
  }
  
  unsigned int u = 2;
  if (u &gt; static_cast&lt;unsigned int&gt;(MY_ENUM_VALUE))
  {
      // do more stuff
  }
  </code></pre>
  
  <p>Is this the best practice?</p>
  
  <p>Edit: Does the situation change if the enum is anonymous?</p>