[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits |
Date: |
Wed, 18 Dec 2019 19:26:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Tao Xu <address@hidden> writes:
> On 12/18/2019 9:33 AM, Tao Xu wrote:
>> On 12/17/2019 6:25 PM, Markus Armbruster wrote:
[...]
>>> Also fun: for "0123", we use uint64_t 83, not double 123.0. But for
>>> "0123.", we use 123.0, not 83.
>>>
>>> Do we really want to accept octal and hexadecimal integers?
>>>
>>
>> Thank you for reminding me. Octal and hexadecimal may bring more
>> confusion. I will use qemu_strtou64(nptr, &suffixu, 10, &valu) and
>> add test for input like "0123".
>>
>
> Hi Markus,
>
> After I use qemu_strtou64(nptr, &suffixu, 10, &valu), it cause another
> question. Because qemu_strtod_finite support hexadecimal input, so in
> this situation, it will parsed as double. It will also let large
> hexadecimal integers be rounded. So there may be two solution:
>
> 1: use qemu_strtou64(nptr, &suffixu, 0, &valu) and parse octal as
> decimal. This will keep hexadecimal valid as now.
>
> "0123" --> 123; "0x123" --> 291
How would you make qemu_strtou64() parse octal as decimal?
> 2: use qemu_strtou64(nptr, &suffixu, 10, &valu) and reject octal and
> decimal.
>
> "0123" --> Error; "0x123" --> Error
How would you reject the 0x prefix?
- [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Tao Xu, 2019/12/04
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Markus Armbruster, 2019/12/05
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Tao Xu, 2019/12/09
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Markus Armbruster, 2019/12/17
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Tao Xu, 2019/12/17
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Tao Xu, 2019/12/18
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits,
Markus Armbruster <=
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Tao Xu, 2019/12/19
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Markus Armbruster, 2019/12/19
- Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Eric Blake, 2019/12/18
Re: [PATCH] util/cutils: Expand do_strtosz parsing precision to 64 bits, Christophe de Dinechin, 2019/12/17