You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Vitali Lovich (JIRA)" <ji...@apache.org> on 2012/11/21 12:25:58 UTC

[jira] [Updated] (THRIFT-1758) bad_lexical_cast using TJSONProtocol

     [ https://issues.apache.org/jira/browse/THRIFT-1758?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vitali Lovich updated THRIFT-1758:
----------------------------------

    Environment: 
boost 1.52.0
iOS 6.0

  was:
boost 1.52.0
iOS 6.0
iOS simulator 6.0

    
> bad_lexical_cast using TJSONProtocol
> ------------------------------------
>
>                 Key: THRIFT-1758
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1758
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: boost 1.52.0
> iOS 6.0
>            Reporter: Vitali Lovich
>            Priority: Critical
>
> try{
>     std::string str("-0.003024283066062361")
>     double d = boost::lexical_cast<double>(str);
>     // bad_lexical_cast is thrown
> } catch (const boost::bad_lexical_cast& e) {
>     std::cerr << e.what() << std::endl;
> }
> bad_lexical_cast is thrown.  This is a problem for TJSONProtocol which relies on lexical_cast handling this properly.
> Looking through the code, it looks to have to do something with the compile-time precision.
> defining BOOST_LCAST_NO_COMPILE_TIME_PRECISION appears to resolve this issue (although at the cost of performance).
> this problem also doesn't appear to happen all the time with the same input data.  sometime's it's reproducible every time, other times it isn't.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira