[libcxx-commits] [libcxx] [libc++] Cast 0 to `__locale_t` in `text_encoding.cpp` (PR #205882)

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 25 13:04:10 PDT 2026


================
@@ -31,7 +31,7 @@ static text_encoding __make_text_encoding(const char* __name) {
 
 std::text_encoding __get_locale_encoding(const char* __name) {
   if (__name == nullptr)
-    return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(nullptr)));
+    return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(0)));
----------------
smallp-o-p wrote:

I think that's the common way of initializing a "default" (probably a misnomer) `locale_t`. At least looking at some manpages e.g.

[newlocale()](https://www.man7.org/linux/man-pages/man3/newlocale.3.html)

But that is C though.

https://github.com/llvm/llvm-project/pull/205882


More information about the libcxx-commits mailing list