title: What does (int)(unsigned char)(x) do in C?
body: <p>In <a href="http://lxr.free-electrons.com/source/include/linux/ctype.h#L20" rel="noreferrer">ctype.h, line 20</a>, <code>__ismask</code> is defined as:</p>
  
  <pre><code>#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
  </code></pre>
  
  <p>What does <code>(int)(unsigned char)(x)</code> do? I guess it casts <code>x</code> to unsigned char (to retrieve the first byte only regardless of <code>x</code>), but then why is it cast to an <code>int</code> at the end?</p>