On Monday 08 September 2025 09:19:52 Kirill Makurin wrote: > This is a very good idea. It is also would be good to check that functions > which return char as an int avoid sign-extension. For example, this was a > reason to replace wctob() for UCRT, CRT's wctob() which sign-extends its > return value making it impossible to distinguish `return (char)255` from EOF > which is returned on failure. (yes, it is a CRT bug, but the same idea) > > I also wanted to suggest check usage of [f]printf functions in mingw-w64, > and we use them, replace them with wide [f]wprintf instead. The reason is > that applications may call _setmode[1] on stdout/stderr with one of > _O_U8TEXT, _O_U16TEXT and _O_WTEXT, and if they do so, [f]printf will fail > and produce no output.
Now I reproduced the same problem that _O_U8TEXT does not work together with fprintf during looking at assert problem in different email. I should have read emails in different order. > Speaking of _setmode, I wonder if there is a way to obtain which translation > mode is set on particular file descriptor? It's kinda dumb that there is no > way to get it other than calling _setmode (it returns previous translation > mode). I will look at this. I have an idea how to get this information. > - Kirill Makurin > > [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode Here is written: You can also pass _O_U16TEXT, _O_U8TEXT, or _O_WTEXT to enable Unicode mode ... Unicode mode is for wide print functions (for example, wprintf) and is not supported for narrow print functions. So it is somehow documented. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
