title: how enums work with undefined values?
body: <pre><code>typedef enum {my_false, my_true = 5, my_maybe = 3} my_bool;
  
  my_bool f(){return 2;}
  int g(){return my_true;}
  
  int main (){
      my_bool mb = f();
      int i = f();
      printf("%d--%d\n", mb==i, mb);
  
      mb = g();
      i = g();
      printf("%d--%d\n", mb==i, mb);
  
      return 0;
  }
  </code></pre>
  
  <p>What is happening when a function returns <code>enum</code>?</p>
  
  <p>As I see it, in my code, <code>f()</code> can return any number, even if it's not defined inside the <code>my_bool enum</code>, but it seems that no matter what I return (like <code>2</code> in my example, the value stored inside <code>my_bool mb = f();</code> would <code>1</code> unless I return <code>0</code>or<code>my_false</code>.</p>
  
  <ol>
  <li><p>Is this what should happen? does <code>enum</code> decays immediately to <code>int</code> 
  and thus has no problem with numbers that aren't defined in it?</p></li>
  <li><p>Why gcc generates warning: <code>comparison between signed and unsigned integer expressions [-Wsign-compare]...  printf("%d--%d\n", mb==i, mb);</code>? isn't <code>enum</code> a <code>signed int</code>?</p></li>
  <li>why defining the same value with different identifiers ok? (i.e. <code>typedef enum {xx = 1, yy = 1} zz;</code>)</li>
  </ol>