title: negative integer implicitly converted to unsigned type
body: <p>How would one set/unset enum value for something like the following. Using gcc, I get this annoying warning:</p>
  
  <pre><code>test.c:37: warning: negative integer implicitly converted to unsigned type
  test.c:39: warning: negative integer implicitly converted to unsigned type
  test.c:41: warning: negative integer implicitly converted to unsigned type
  test.c:43: warning: negative integer implicitly converted to unsigned type
  </code></pre>
  
  <p>code is:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  typedef enum {
   ONE = 0x1,
   TWO = 0x2,
   THREE = 0x4,
   FOUR = 0x8,
  } options;
  
  static const char *byte_to_binary (int x)
  {
    int z;
    static char b[9];
    b[0] = '\0';
  
    for (z = 256; z &gt; 0; z &gt;&gt;= 1)
      {
      strcat(b, ((x &amp; z) == z) ? "1" : "0");
      }
  
    return b;
  }
  
  int main(int argc, char *argv[])
  {
    options o = 0;
    printf( "%s\n", byte_to_binary(o));
    o |= ONE;
    printf( "%s\n", byte_to_binary(o));
    o |= TWO;
    printf( "%s\n", byte_to_binary(o));
    o |= THREE;
    printf( "%s\n", byte_to_binary(o));
    o |= FOUR;
    printf( "%s\n", byte_to_binary(o));
    o &amp;= ~FOUR;
    printf( "%s\n", byte_to_binary(o));
    o &amp;= ~THREE;
    printf( "%s\n", byte_to_binary(o));
    o &amp;= ~TWO;
    printf( "%s\n", byte_to_binary(o));
    o &amp;= ~ONE;
    printf( "%s\n", byte_to_binary(o));
  
    return 0;
  }
  </code></pre>