How to determine if a function (wcwidth/wcswidth) is AS- and AC-safe?
Nikola Arlotti
nikola.arlotti@gmail.com
Mon Jul 13 19:57:55 GMT 2026
Hi all,
I was on Arjun Shankar's glibc patch writing workshop on DevConf Czechia,
and I got the patch for the bug
https://sourceware.org/bugzilla/show_bug.cgi?id=33740 (documenting the
functions wcwidth and wcswidth). The patch is almost ready, one question
remains - are wcwidth and wcswidth AC- and AS-safe? Other, similar
functions in ctype.texi are AS- and AC-safe, but I would prefer to be sure
before submitting the patch rather than base it on vibes only (especially
that they're defined elsewhere in the codebase).
Places I've looked:
- the Linux manpages describe them only as "MT-safe locale"
- looking at manpages of similar functions that already are in the glibc
manual yields inconclusive results, they're either described as MT-safe or
not safety is not mentioned at all, even when the manual describes them as
MT-safe, AS-safe and AC-safe
-
https://sourceware.org/glibc/manual/2.42/html_node/POSIX-Safety-Concepts.html
states that only 3 functions are defined by POSIX as AC-safe (none of them
being "my" functions), but also states that safety in glibc doesn't have to
neccesarily follow POSIX safety requirements
- trying to search for info outside of glibc docs and Linux manpages
brought up nothing new but more definitions of various levels of safety
So, question as in topic - what steps should I take while writing
documentation to determine the safety level of functions? Is there perhaps
any documentation I missed? Or maybe is there some heuristic I can go by?
Thank you for your time,
Nikola Arlotti
More information about the Libc-help
mailing list