On Friday 03 July 2026 12:59:42 LIU Hao wrote: > 在 2026-7-2 23:54, Kirill Makurin 写道: > > Pali Rohár <[email protected]> wrote: > > > > > I would like to spend some more time on trying to fix the _assert > > > function, rather than removing the current workaround as it is the > > > current changes. > > > > I disagree that `_assert` needs to be fixed. Its inability to write to > > Unicode streams is consistent with stdio I/O functions and functions such > > as `perror`. The only thing that makes `_assert` special is that it is > > being used for assert(). > > > > If anything, I think this fix needs to go into `_wassert`; e.g. make it > > switch mode to `_O_TEXT` in CRTs which may redirect to OS msvcrt.dll, which > > in turns allows them to enable Unicode translation mode on `stderr`. > If there's still disagreement about this change, it doesn't look like a clear > signal for it to be checked in.
"crt: improve _wassert() emulation" change is fine. This should be merged. I will prepare followup improvement for the "_set_error_mode" part as mentioned in the comment. About the "crt: remove mingw-w64 wrapper for _assert()". The current implementation is not perfect, but can be improvement. I'm still thinking how to handle it and improve it. So could you let the wrapper here for some time (before complete removal)? Function _assert is useful, as it allows to do "assert" with custom information about file and line number. This is useful for propagation of source line if having wrapper around the assert. > Because Microsoft CRT calls `_wassert()`, this looks like a correct > direction to move. By default GCC assumes source files are in UTF-8 which > has an effect on the encoding of `__FILE__`, so non-ASCII paths in messages > might become gibberish. That is truth. But this is rather general problem of all __FILE__ macro usage. Which is in lot of mingw-w64 header files. This is about "crt: always use _wassert() to implement assert() macro". Anyway, if you want to forward calls from assert() macro to _wassert() function by default, then please at least provide a way to let it forward to _assert(), for example by some macro. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
