@node uchar.h
@section @file{uchar.h}

ISO C23 specification:@* @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf} section 7.30.

POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/uchar.h.html}

Defines the types @code{char16_t}, @code{char32_t},
@code{mbstate_t} and @code{size_t}, and declares the
functions @code{mbrtoc16}, @code{c16rtomb}, @code{mbrtoc32},
@code{c32rtomb}.

Gnulib module: uchar-h or uchar-h-c23
@mindex uchar-h
@mindex uchar-h-c23

Portability problems fixed by either Gnulib module @code{uchar-h} or @code{uchar-h-c23}:
@itemize
@item
This header file is missing on many non-glibc platforms:
glibc 2.15, macOS 14, FreeBSD 6.4, NetBSD 10.0, OpenBSD 7.3, Minix 3.1.8, AIX 7.1, HP-UX 11.31, Solaris 11.3, Cygwin 3.4.x, mingw, MSVC 9.
@item
This file is not self-contained on some platforms:
@c https://dev.haiku-os.org/ticket/17040
Haiku.
@item
This file produces compilation errors in C++ mode on some platforms:
AIX 7.2 with xlclang++.
@end itemize

Portability problems fixed by Gnulib module @code{uchar-h-c23}:
@itemize
@item
@code{char32_t} values may not be Unicode code points.
This is the case in ISO C 11 compliant but not ISO C 23 compliant
implementations.
@end itemize

Portability problems fixed by Gnulib modules
@code{btoc32},
@code{c32_apply_mapping}, @code{c32_apply_type_test},
@code{c32_get_mapping}, @code{c32_get_type_test},
@code{c32isalnum}, @code{c32isalpha}, @code{c32isblank},
@code{c32iscntrl}, @code{c32isdigit}, @code{c32isgraph},
@code{c32islower}, @code{c32isprint}, @code{c32ispunct},
@code{c32isspace}, @code{c32isupper}, @code{c32isxdigit},
@code{c32rtomb}, @code{c32snrtombs}, @code{c32srtombs},
@code{c32stombs}, @code{c32swidth}, @code{c32tob},
@code{c32tolower}, @code{c32toupper}, @code{c32width}:
@itemize
@item
The @code{char32_t} type of ISO C 23 and POSIX @code{<uchar.h>} lacks
counterparts of several standard @code{wchar_t} functions declared in
@code{<wchar.h>} and @code{<wctype.h>}.
This shortcoming is ameliorated by these Gnulib modules,
each of which arranges for @code{<uchar.h>} to declare a
Gnulib-specific function and to make visible the symbols @code{wint_t}
and @code{WEOF} if the symbols are part of that function's API.
@end itemize

Portability problems not fixed by Gnulib:
@itemize
@item
POSIX.1-2024 allows, but does not require, this file to make visible
all symbols from the headers @code{<stddef.h>}, @code{<stdint.h>}, and
@code{<wchar.h>}.
Programs should not assume that these other symbols are visible merely
because this file is included, or that they are invisible because only
this file is included.
@end itemize
