[
https://issues.apache.org/jira/browse/THRIFT-4138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756793#comment-16756793
]
Jim Apple commented on THRIFT-4138:
-----------------------------------
It seems like I should also check {{str.fail()}}, but I wonder if this is
undefined or implementation defined behavior. It differs depending on the
standard library:
{noformat}
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(int argv, char ** argc) {
istringstream str(argc[1]);
str.imbue(std::locale::classic());
unsigned int i;
str >> i;
cout << boolalpha << str.bad() << " " << str.fail() << " " << not str.eof()
<< endl;
cout << i << endl;
}
{noformat}
output
{noformat}
$ clang++-5.0 -stdlib=libc++ -ggdb3 -O0 fromstr.cc && ./a.out -1
false true false
0
{noformat}
{noformat}
$ clang++-5.0 -stdlib=libstdc++ -ggdb3 -O0 fromstr.cc && ./a.out -1
false false false
4294967295
{noformat}
> Fix remaining undefined behavior invalid vptr casts in C++ library
> ------------------------------------------------------------------
>
> Key: THRIFT-4138
> URL: https://issues.apache.org/jira/browse/THRIFT-4138
> Project: Thrift
> Issue Type: Sub-task
> Components: C++ - Library
> Reporter: Jens Geyer
> Assignee: Jim Apple
> Priority: Major
> Fix For: 0.11.0
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)