Menu

#35 Big integer values are decoded as real

0.5.0
closed-rejected
nobody
Reader (16)
6
2015-03-06
2011-07-20
jmar8692
No

When decoding integer value greater than Value::MaxUInt/10 == 429496729, the node is decoded as real value, although it could and should be decoded as unsigned integer.

This renders common testing for isIntegral() or isInt() almost useless, because you can't be ever sure if the type was not changed to real as a result of the big value. You would always have to use isReal() and convert the value back to integer.

IMHO, all this threshold stuff should be removed and integral values should be always treated as integers, unless they exceed the MaxInt/MaxUInt thresholds, off course.

Discussion

  • jmar8692

    jmar8692 - 2011-07-20
    • priority: 5 --> 6
     
  • Christopher Dunn

    I would rather let users decide how to decode numbers, but that is difficult with the current API.

    If this is still a problem with the latest code, please open a new issue: https://github.com/open-source-parsers/jsoncpp/issues/new

     
  • Christopher Dunn

    • status: open --> closed-rejected
    • Group: --> 0.5.0
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.