title: Return value of istream::get()
body: <p>This question is about the member function of <code>basic_istream</code>:</p>
  <pre><code>int_type get();
  </code></pre>
  <p>as described by N3337 27.7.2.3#4  (that is [istream.unformatted]). Presumably the actual Standard text is the same.</p>
  <p>The text says:</p>
  <blockquote>
  <p>After constructing a sentry object, extracts a character <code>c</code>, if one is available</p>
  <p><em>Returns:</em> <code>c</code> if available, otherwise <code>traits::eof()</code></p>
  </blockquote>
  <p>This text suggests that negative <code>char</code>s should return a negative value. We could compare with the next section, <code>basic_istream&lt;charT,traits&gt;&amp; get(char_type &amp;c)</code>, which says:</p>
  <blockquote>
  <p>After constructing a sentry object, extracts a character, if one is available, and assigns it to <code>c</code>.</p>
  </blockquote>
  <p>This is very similar wording to <code>get()</code>.</p>
  <p>However, when I try <code>get()</code>, negative chars return a positive value; i.e. <code>basic_istream::get()</code>  behaves like the C function <code>getchar()</code>. This would be the sensible behaviour (to allow signalling of EOF), however the Standard text does not seem to specify this.  The C99 description of <code>getchar()</code> and friends specifically says that it returns the value <em>converted to an unsigned char</em>. But <code>basic_istream::get()</code> does not have any equivalant text.</p>
  <p>My question is: is <code>get()</code> meant to be specified to return a value in the range <code>0...UCHAR_MAX</code> union <code>EOF</code>? Or should it return the actual <code>char</code> converted to <code>int_type</code> (via implicit conversion)? Or something else? What exactly does and does not the Standard specify here?</p>
  <p>If &quot;something else&quot;, how do I transform the result of <code>int i = cin.get()</code> to match the char value read by <code>char ch; cin.get(ch);</code> for the same input character?</p>