marzer / tomlplusplus

Header-only TOML config file parser and serializer for C++17.
https://marzer.github.io/tomlplusplus/
MIT License
1.58k stars 152 forks source link

16 digit Hexadecimals #224

Closed chrimbo closed 4 months ago

chrimbo commented 6 months ago

Environment

toml++ version and/or commit hash:
toml++ v3.4.0

Compiler:
MinGW81_64, GCC 8.1.0

C++ standard mode:
c++17

Target arch:
x86_64

Describe the bug

I'm trying to parse Value=0xca343183acdf73b4 , resulting in an "Error while parsing hexadecimal integer: '0xca343183acdf73b4' is not representable in 64 bits "

Also tried Value=-0x35CBCE7C53208C4C , resulting in "Error while parsing hexadecimal interger: expected '0', saw '-'"

and
Value=0x-35CBCE7C53208C4C, also resulting in "Error while parsing hexadecimal integer: expected digit, saw '-'"

marzer commented 4 months ago

Hi, sorry for taking so long to get back to you. Looking into this now.

Re your second example, the negative number: that behaviour is correct - hexadecimal numbers are always unsigned in TOML.

marzer commented 4 months ago

Oh, ok, it's correct: Integers in TOML are 64-bit signed, and that value is outside the representable by an int64_t (i.e. it's higher than INT64_MAX). This isn't a bug, I'm afraid. I'll refine the error message to be a bit clearer.

chrimbo commented 4 months ago

So there's no way to express 0xca343183acdf73b4 other than writing it as -3866893791544805260

marzer commented 4 months ago

In TOML, yep.

chrimbo commented 4 months ago

Thanks for clarification