title: Do I cast the result of malloc?
body: <p>In <a href="http://stackoverflow.com/questions/571945/getting-a-stack-overflow-exception-when-declaring-a-large-array">this question</a>, someone suggested in a <a href="http://stackoverflow.com/questions/571945/getting-a-stack-overflow-exception-when-declaring-a-large-array#comment388297_571961">comment</a> that I should <em><strong>not</strong></em> cast the result of <code>malloc</code>. i.e., I should do this:</p>
  <pre><code>int *sieve = malloc(sizeof(*sieve) * length);
  </code></pre>
  <p>rather than:</p>
  <pre><code>int *sieve = (int *) malloc(sizeof(*sieve) * length);
  </code></pre>
  <p>Why would this be the case?</p>