Date: Thu, 16 Jan 2025 07:33:27 +0100
On Sat, Jan 11, 2025 at 05:06:26PM +0000, Lénárd Szolnoki via Std-Proposals wrote:
>
>
> On 11 January 2025 16:41:09 GMT, Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> wrote:
> >On Saturday 11 January 2025 12:43:59 Brasilia Standard Time Jonathan Wakely
> >via Std-Proposals wrote:
> >> The original reason for requiring a std::string is that stoi etc are
> >> defined in terms of strtoll which requires a null terminated string. A
> >> string_view isn't null terminated.
> >>
> >> The functions would need to be re-specified in terms of std::from_chars.
> >
> >They can be specified as "behave exactly like strtoll" and not require null
> >termination. The difference is mostly the handling of what comes before the
> >number: the base prefixes when base == 0, whitespace and the plus sign.
>
> strtoll is also technically locale-dependent, but I don't know what that means in practice. In what locales (if any) is the behavior different?
The most common variation in numeric parsing is if . or , is used as thousands
separator.
Then there was some Afghan locale that used alternate symbols for the digits
when I last checked.
The effect of this is that strtoll could accept more than you expected.
/MF
>
>
> On 11 January 2025 16:41:09 GMT, Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> wrote:
> >On Saturday 11 January 2025 12:43:59 Brasilia Standard Time Jonathan Wakely
> >via Std-Proposals wrote:
> >> The original reason for requiring a std::string is that stoi etc are
> >> defined in terms of strtoll which requires a null terminated string. A
> >> string_view isn't null terminated.
> >>
> >> The functions would need to be re-specified in terms of std::from_chars.
> >
> >They can be specified as "behave exactly like strtoll" and not require null
> >termination. The difference is mostly the handling of what comes before the
> >number: the base prefixes when base == 0, whitespace and the plus sign.
>
> strtoll is also technically locale-dependent, but I don't know what that means in practice. In what locales (if any) is the behavior different?
The most common variation in numeric parsing is if . or , is used as thousands
separator.
Then there was some Afghan locale that used alternate symbols for the digits
when I last checked.
The effect of this is that strtoll could accept more than you expected.
/MF
Received on 2025-01-16 06:33:35