title: Smart typedefs
body: <p>I've always used typedef in embedded programming to avoid common mistakes:</p>
  
  <p><code>int8_t</code> - 8 bit signed integer<br>
  <code>int16_t</code> - 16 bit signed integer<br>
  <code>int32_t</code> - 32 bit signed integer<br>
  <code>uint8_t</code> - 8 bit unsigned integer<br>
  <code>uint16_t</code> - 16 bit unsigned integer<br>
  <code>uint32_t</code> - 32 bit unsigned integer</p>
  
  <p>The recent embedded muse (issue 177, not on the website yet) introduced me to the idea that it's useful to have some performance specific typedefs.  <a href="http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html" rel="noreferrer">This standard</a> suggests having typedefs that indicate you want the fastest type that has a minimum size.</p>
  
  <p>For instance, one might declare a variable using <code>int_fast16_t</code>, but it would actually be implemented as an <code>int32_t</code> on a 32 bit processor, or <code>int64_t</code> on a 64 bit processor as those would be the fastest types of at least 16 bits on those platforms.  On an 8 bit processor it would be <code>int16_t</code> bits to meet the minimum size requirement.</p>
  
  <p>Having never seen this usage before I wanted to know</p>
  
  <ul>
  <li>Have you seen this in any projects, embedded or otherwise?</li>
  <li>Any possible reasons to avoid this sort of optimization in typedefs?</li>
  </ul>