[libcxx-commits] [libcxx] [libc++] Move _LIBCPP_GET_C_LOCALE to the locale base API (PR #222924)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 16 02:19:46 PDT 2026
================
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_GET_C_LOCALE_H
----------------
philnik777 wrote:
> About file naming: I'd rather name the file something like `support/default/get_c_locale.h` or something that expresses the fact that this is an implementation bit to be reused by other "locale backends". Otherwise, it seems weird that `bsd_like.h` wouldn't use it.
Sure.
> Ideally we'd name it based on what's "special" about the configurations that use it, a bit like `<__locale_dir/support/no_locale/characters.h>` where it's obvious that the header is intended to be used on platforms that don't have localization support.
>
> What's special about the implementation of `__cloc`?
I don't think there is anything special here? It's the default implementation if there is nothing special to make it faster.
> ```
> static __locale::__locale_t result = __locale::__newlocale(_LIBCPP_ALL_MASK, "C", 0);
> ```
>
> Actually, it kinda seems like this is better than the implementation we use on Apple and FreeBSD, no?
How? We avoid calling a function and potentially locking code. That seems like a rather big win to me.
https://github.com/llvm/llvm-project/pull/222924
More information about the libcxx-commits
mailing list