Re: Peculiar bug when converting int's to std::strings using MSVC 2015

Arash Partow <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CACS6Y7JsLabCFohdf6nPa-frwosqk3e5QK+=UCnf0m=NS86TAg@mail.gmail.com>
On Thu, Mar 9, 2017, Seth  wrote:
>
> Can you specify what the values for i are? Perhaps just replace:
>
>  printf("ERROR
> s1:%s\ts2:%s\n",s1.c_str(),s2.c_str());
>
>
> With
>
>  std::cout << "Mismatch: i=" << i << " s1=" << s1 << " s2=" << s2 <<
> "\n";
>
>

I've modified the example code as suggested.

https://gist.github.com/anonymous/b3987d1514fe64dc9a4cd13c7cfd9f09


Here is the output of the first several lines:

Mismatch: i=-40000000 s1=-4254967296 s2=-40000000
Mismatch: i=-39999999 s1=-4254967297 s2=-39999999
Mismatch: i=-39999998 s1=-4254967298 s2=-39999998
Mismatch: i=-39999997 s1=-4254967299 s2=-39999997
Mismatch: i=-39999996 s1=-4254967300 s2=-39999996
Mismatch: i=-39999995 s1=-4254967301 s2=-39999995
Mismatch: i=-39999994 s1=-4254967302 s2=-39999994
Mismatch: i=-39999993 s1=-4254967303 s2=-39999993
Mismatch: i=-39999992 s1=-4254967304 s2=-39999992
Mismatch: i=-39999991 s1=-4254967305 s2=-39999991
Mismatch: i=-39999990 s1=-4254967306 s2=-39999990
Mismatch: i=-39999989 s1=-4254967307 s2=-39999989
Mismatch: i=-39999988 s1=-4254967308 s2=-39999988
Mismatch: i=-39999987 s1=-4254967309 s2=-39999987
Mismatch: i=-39999986 s1=-4254967310 s2=-39999986
Mismatch: i=-39999985 s1=-4254967311 s2=-39999985
Mismatch: i=-39999984 s1=-4254967312 s2=-39999984
Mismatch: i=-39999983 s1=-4254967313 s2=-39999983
Mismatch: i=-39999982 s1=-4254967314 s2=-39999982
Mismatch: i=-39999981 s1=-4254967315 s2=-39999981


As before all the values are a 'mismatch'.



Arash

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.