[libcxx-commits] [libcxx] [libcxx][locale] Refactor strtonum functions using __str_to_float_c_locale<FloatT> (PR #222081)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 11 03:24:41 PDT 2026
================
@@ -307,17 +307,17 @@ _LIBCPP_HIDE_FROM_ABI _Tp __do_strtod(const char* __a, char** __p2);
template <>
inline _LIBCPP_HIDE_FROM_ABI float __do_strtod<float>(const char* __a, char** __p2) {
- return __locale::__strtof(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ return __locale::__str_to_float_c_locale<float>(__a, __p2, _LIBCPP_GET_C_LOCALE);
----------------
philnik777 wrote:
Urgh. `_LIBCPP_GET_C_LOCALE` should really just be part of the locale base API (and after writing that I realized there is a FIXME about that...). Do you think you could refactor that as well? Moving the common case with `__cloc()` into a header and then `#define _LIBCPP_GET_C_LOCALE` for Apple/FreeBSD/NetBSD specifically? (Although, this should arguably be a function, so we might as well do it at the same time). Sorry for putting so much on you, I didn't realize it would take on this scale.
If not, I can work on it later.
https://github.com/llvm/llvm-project/pull/222081
More information about the libcxx-commits
mailing list