[libc-commits] [libc] [libc] Implement locale variants for 'stdlib.h' functions (PR #105718)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Aug 22 13:45:43 PDT 2024


================
@@ -17,6 +17,11 @@
 #define EXIT_SUCCESS 0
 #define EXIT_FAILURE 1
 
+#ifndef MB_CUR_MAX
+// We only support the "C" locale right now, so this is a constant byte.
+#define MB_CUR_MAX 1
----------------
jhuber6 wrote:

So, in a real implementation this would be non-constant. And I don't think so, this is specifically mentioned in the standard as being provided by `stdlib.h`

```
       The <stdlib.h> header shall define the following macro which shall
       expand to a positive integer expression with type size_t:

       {MB_CUR_MAX}
                   Maximum number of bytes in a character specified by the
                   current locale (category LC_CTYPE).

       In the POSIX locale the value of {MB_CUR_MAX} shall be 1.
```

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


More information about the libc-commits mailing list