Hash :
ccb59e4c
Author :
Date :
2023-04-19T17:59:03
wcsncmp: Work around two ISO C compliance bugs on several platforms. * lib/wchar.in.h (wcsncmp): Consider REPLACE_WCSNCMP. * lib/wcsncmp-impl.h (wcsncmp): Don't assume that the two wide characters are in the range 0..INT_MAX. * m4/wcsncmp.m4 (gl_FUNC_WCSNCMP): Test whether wcsncmp works for all wide characters. Set REPLACE_WCSNCMP. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSNCMP. * modules/wchar (Makefile.am): Substitute REPLACE_WCSNCMP. * modules/wcsncmp (Status, Notice): Un-obsolete this module. (configure.ac): Consider REPLACE_WCSNCMP. * doc/posix-functions/wcsncmp.texi: Mention the two bugs.
@node wcsncmp
@section @code{wcsncmp}
@findex wcsncmp
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsncmp.html}
Gnulib module: wcsncmp
Portability problems fixed by Gnulib:
@itemize
@item
This function compares the wide characters as if they were unsigned, although
@code{wchar_t} is signed, on some platforms:
glibc 2.14.1 on x86 or x86_64, musl libc 1.2.3, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, Solaris 11.4.
@item
This function may return a wrong result if the two arguments are of different
length, on some platforms:
AIX 7.2 in 64-bit mode.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize