|
Boost Users : |
Subject: Re: [Boost-users] [Spirit] Qi int_parser rejecting a negative signed std::intmax_t
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-11-12 23:06:43
On 13/11/2018 11:57, Michael Powell wrote:
>> Decimal values can be negative. Octal and hex values can't.
>
> Right, I understand that. However, ultimately when the AST is
> synthesized, I do not care whether numeric literals were hex, octal,
> decimal, or some other indeterminate radix. The sign applies to
> whatever that result is, at least according to the language spec I am
> working with.
That's fine though -- as I said you can still just use intptr_t in the
AST and it will store the signed two's complement equivalent of whatever
literal was specified, regardless of radix. You just need to specify
the signedness correctly in the actual parse step.
I'm not sure exactly what was making it fail with intmax_t, but it's not
entirely surprising, and using uintmax_t to parse makes it work as expected.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net