title: Set a FourCC value in C++
body: <p>I want to set a <a href="http://en.wikipedia.org/wiki/FourCC" rel="nofollow noreferrer">FourCC</a> value in C++, i.e. an unsigned 4 byte integer. </p>
  
  <p>I suppose the obvious way is a #define, e.g. </p>
  
  <pre><code>#define FOURCC(a,b,c,d) ( (uint32) (((d)&lt;&lt;24) | ((c)&lt;&lt;16) | ((b)&lt;&lt;8) | (a)) )
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>uint32 id( FOURCC('b','l','a','h') );
  </code></pre>
  
  <p>What is the most elegant way you can think to do this?</p>