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`.

The question is how do we restore it if application uses SIGABRT handler to 
escape from `abort`?

> And also as I wrote in other email I'm not very happy
> with forcing all asserts to go into UNICODE code path, even those which
> are narrow char*.

I don't see a problem here. Also, recent MSVC does the same.

Storing assertion message as `wchar_t *`, which is UTF-16 on Windows, allows to 
store it independently from execution charset used during compilation (which is 
usually UTF-8 with gcc and clang). Note that there are also rare cases when 
production binaries contain assertions in some places.

- Kirill Makurin

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

Reply via email to