title: string parsing to double fails in C++
body: <p>Here's a fun one I've been trying to figure out.  I have the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      string s("5");
      istringstream stream(s);
  
      double theValue;
      stream &gt;&gt; theValue;
  
      cout &lt;&lt; theValue &lt;&lt; endl;
      cout &lt;&lt; stream.fail();
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>0
  1
  </code></pre>
  
  <p>I don't understand why this is failing. Could somebody please tell me what I'm doing wrong?</p>
  
  <p>Thanks,</p>
  
  <p>helixed</p>
  
  <p>EDIT:</p>
  
  <p>Okay, sorry to turn this into a <a href="https://stackoverflow.com/questions/2633092/problem-with-istringstream-in-c">double post</a>, but this looks like a problem specific to Xcode.  If I compile this in g++, the code works without a problem.  Does anybody have an idea why this is happening in Xcode, and how I could possibly fix it?</p>