title: *Might* an unsigned char be equal to EOF?
body: <p>When using <code>fgetc</code> to read the next character of a stream, you usually check that the end-of-file was not attained by</p>
  
  <pre><code>if ((c = fgetc (stream)) != EOF)
  </code></pre>
  
  <p>where <code>c</code> is of <code>int</code> type. Then, either the end-of-file has been attained and the condition will fail, or <code>c</code> shall be an <code>unsigned</code> char converted to <code>int</code>, which is expected to be different from <code>EOF</code> —for <code>EOF</code> is ensured to be negative. Fine... apparently.</p>
  
  <p>But there is a small problem... Usually the <code>char</code> type has no more than 8 bits, while <code>int</code> must have at least 16 bits, so every <code>unsigned char</code> will be representable as an <code>int</code>. Nevertheless, in the case <code>char</code> would have 16 or 32 bits (I know, this is never the case in practice...), there is no reason why one could not have <code>sizeof(int) == 1</code>, so that it would be (theoretically!) possible that <code>fgetc (stream)</code> returns <code>EOF</code> (or another negative value) but that end-of-file has not been attained...</p>
  
  <p>Am I mistaken? Is it something in the C standard that prevents <code>fgetc</code> to return <code>EOF</code> if end-of-file has not been attained? (If yes, I could not find it!). Or is the <code>if ((c = fgetc (stream)) != EOF)</code> syntax not fully portable?...</p>
  
  <p><strong><em>EDIT: Indeed, this was a duplicate of Question #3860943. I did not find that question at first search. Thank for your help! :-)</em></strong></p>