[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strtol, strtoll, strtoul, strtoull: Make ISO C 23 compliant
From: |
Eric Blake |
Subject: |
Re: strtol, strtoll, strtoul, strtoull: Make ISO C 23 compliant |
Date: |
Fri, 17 Mar 2023 07:52:47 -0500 |
User-agent: |
NeoMutt/20220429 |
On Thu, Mar 16, 2023 at 04:05:18PM +0100, Bruno Haible wrote:
> ISO C 23 § 7.24.1.7 in combination with § 6.4.4.1 specifies that strtol,
> strtoll, strtoul, strtoull need to accept binary integer syntax as input,
> e.g. "0b101010" for 42.
>
> This patch implements it, and augments the unit tests accordingly.
>
>
> 2023-03-16 Bruno Haible <bruno@clisp.org>
>
> strtol, strtoll, strtoul, strtoull: Make ISO C 23 compliant.
> * lib/strtol.c (INTERNAL (strtol)): Treat 'b' and base 2 like 'x' and
> base 16. Based on glibc commit 64924422a99690d147a166b4de3103f3bf3eaf6c
> by Joseph Myers.
C23 also supports literals with thousands separators, such as
0b0000'1111 or 0xab'cd. Are strtol* required to support this as well?
/me goes and reads https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2626.pdf
"It is not proposed for the strto* family of functions from the C
Standard Library to support digit separators at this time"
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org