It seems that gnulib[1][2] is aware of both issues. I can prepare patches for 
this when I will look for declarations in [w]ctype.h which may need 
de-duplication, which I plan to do once my patch series for conio.h is reviewed.

- Kirill Makurin

[1] https://www.gnu.org/software/gnulib/manual/html_node/iswprint.html
[2] https://www.gnu.org/software/gnulib/manual/html_node/wctype.html

________________________________
From: LIU Hao
Sent: Monday, December 29, 2025 6:09 PM
To: [email protected]; Kirill Makurin
Subject: Re: [Mingw-w64-public] Should we replace some [w]ctype.h functions?

在 2025-12-24 09:41, Kirill Makurin 写道:
> The main source of issues comes from _BLANK macro in [w]ctype.h. Microsoft 
> header files mention that _BLANK is only used for *space* characters, so TAB 
> must be handled explicitly. In practice, usage of _BLANK produces 
> inconsistent results.
>
> Also note that _BLANK is used in macro versions of is[w]print, which means 
> they may return non-zero for TAB in the same situations when is[w]ctype 
> would. Library versions of is[w]print seem to follow behavior of 
> is[w]ctype(_BLANK) for TAB character:
>
> 1. When iswctype(L'\t', _BLANK) is non-zero, iswprint(L'\t') is also 
> non-zero. This is behavior of CRTs which do not have is[w]blank functions: 
> msvcr110.dll and older.
> 2. When iswctype(L'\t', _BLANK) is zero, iswprint(L'\t') is also zero. This 
> is behavior of CRTs which have is[w]blank functions: msvcr120.dll and UCRT.
>
> However, library's isprint ('\t') is always zero in "C" locale and non-zero 
> otherwise.
>
> In addition to adding support for "blank" in wctype.c, we may want to replace 
> is[w]ctype functions for all CRTs, which sounds like an overkill to me. I 
> would like to know what others think about this matter and whether it is 
> worth replacing is[w]ctype functions to properly handle TAB character.
I think this depends on what degree that the Microsoft (or standard) behavior 
is acknowledged. This does
sound like an opportunity to improve standard conformance, which should be a 
good thing in general.





--
Best regards,
LIU Hao

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to