[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47413] string to numeric parsing problems wit

From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #47413] string to numeric parsing problems with llvm libc++
Date: Tue, 15 Mar 2016 14:02:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0

Follow-up Comment #8, bug #47413 (project octave):

The following program seems to be enough to demonstrate the problem.  I think
it should write "val: 1, failbit: 0" but it writes "val: 0, failbit: 4" when
using clang++ 3.7 and libc++.

If you put a space between the '1' and the 'a' in the stringstream, it works. 
But I think it should stop reading the double value after the 1 either way. 
Am I wrong?  If the clang+libc++ behavior is standard conforming, we probably
have a lot of work to do to fix the way Octave reads numbers, so I hope I'm
not wrong...

#include <iostream>
#include <sstream>

main (void)
  std::istringstream s1 ("1asdf");
  double val = 0.0;
  is >> val;
  std::cerr << "val: " << val
            << ", failbit: " << (is.rdstate () & std::ios::failbit)
            << std::endl;
  return 0;


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]