title: Flags, enum (C)
body: <p>I'm not very used to programming with flags, but I think I just found a situation where they'd be useful:</p>
  
  <p>I've got a couple of objects that register themselves as listeners to certain events. What events they register for is dependent on a variable that is sent to them when they are constructed. I think a nice way to do this would be to send bitwise OR connected variables, like such: <code>TAKES_DAMAGE | GRABBABLE | LIQUID</code>, etc. Then, in the constructor, the object can check what flags are set and register it self as listener for the ones that are.</p>
  
  <p>But this is where I get confused. Preferably, the flags would be in an <code>enum</code>. But that is also a problem. If we have got these flags:</p>
  
  <pre><code>enum
  {
      TAKES_DAMAGE,/* (0) */
      GRABBABLE, /* (1) */
      LIQUID, /* (2) */
      SOME_OTHER /* (3) */
  };
  </code></pre>
  
  <p>Then sending the flag <code>SOME_OTHER</code> (3) will be the same as sending <code>GRABBABLE | LIQUID</code>, will it not?</p>
  
  <p>How exactly do you deal with this stuff?</p>