[PATCH 2/3]: C++20 P0482R6 and C2X N2653: Implement mbrtoc8, c8rtomb, char8_t

Tom Honermann tom@honermann.net
Sat Jan 8 00:39:11 GMT 2022


This patch provides implementations for the mbrtoc8 and c8rtomb 
functions adopted for C++20 via WG21 P0482R6 [1] and proposed for C2X 
via WG14 N2653 [2]. It also provides the char8_t typedef from WG14 N2653 
[2].

The mbrtoc8 and c8rtomb functions are declared in uchar.h if either of 
the C++20 __cpp_char8_t or _GNU_SOURCE feature test macros are defined.

The char8_t typedef is declared in uchar.h if _GNU_SOURCE is defined and 
__cpp_char8_t is not defined (if __cpp_char8_t is defined, then char8_t 
is a builtin type).

Tested on Linux x86_64.

Tom.

[1]: WG21 P0482R6
      "char8_t: A type for UTF-8 characters and strings (Revision 6)"
      https://wg21.link/p0482r6

[2]: WG14 N2653
      "char8_t: A type for UTF-8 characters and strings (Revision 1)"
      http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: n2653-2.patch
Type: text/x-patch
Size: 27563 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20220107/6b9305c6/attachment-0001.bin>


More information about the Libc-alpha mailing list