[cc: cfe-dev, which I don't subscribe to]
Background: Jonathan Schleifer proposed a patch to add new format
specifiers %k/%K or %C/%S to print respectively single characters or
null-terminated strings of type "of_char32_t", which is a typedef for
char32_t (which in C is a typedef for uint_least32_t and in C++ is a
separate built-in character type).
Discussing offline, Jonathan seemed to agree (reluctantly ;)) with my
reaction that this patch was really needed only to paper over a
problem with the latest C and C++ standards — namely, that they
provide these new character types "char16_t" and "char32_t" but don't
provide any printf or scanf specifiers for them. This is inconsistent
with the previous standard's "wchar_t", which got its own "%lc" and
"%ls" format specifiers.
I propose that it would be a very good idea for the next standard to
provide format specifiers for char16_t and char32_t. I would nominate
"%hc" (char16_t) and "%Lc" (char32_t), and the matching "%hs" (array
of char16_t) and "%Ls" (array of char32_t).
Questions:
(A) Does this proposal step on the toes of any existing proposal —
e.g., is "printing char32_t" already in the pipeline to be fixed in
C1y? I'm only vaguely aware of the stuff going into C++1y and I don't
follow C1y at all.
(B) Would Jonathan's -Wformat patch find greater acceptance if ObjFW's
OFString formatting functions adopted the %Lc/%Ls syntax instead of
the previously proposed %C/%S? (However, I believe Jonathan is right
about still needing a new __attribute__((format(__OFString__,1,2))) to
deal with some other things.)
(C) I'm sure I'll be told anyway
but where would be a proper forum
to bring this up with an eye to standardization? We've got a
complicated dance here among Clang, Apple's libc, Apple's NSLog, GCC,
glibc, the C committee, and probably some others I've forgotten. My
primary goal here is really to convince someone one step closer to to
the C committee that this would be a good idea and they should
champion it in the committee. ![]()
Feel free to contact me offline if you don't want to spam the list.
–Arthur