Pali Rohár <[email protected]> wrote:

> "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)?

I think CRT `_assert` is just fine as is, without any mingw-w64 wrapper. The 
only limitation it has is that it is not working when `stderr` is set to 
Unicode translation mode. IMHO, this affects so few real-world projects that it 
is absolutely neglectable.

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

As I mentioned in other reply, if `_assert` is used in the same way as in, for 
example, t_fseeki64, there is absolutely zero issues with that. There is no 
real difference between real CRT `_assert` and using it with mingw-w64 wrapper.

If some project implements custom `assert` using `_assert`, they should take 
into account that it will not work if application sets Unicode translation mode 
on `stderr`.

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

Is there any practical reason why we would want to do that?

Maybe we could provide helper macros like `_assert_a` and `_assert_w` which are 
versions of `assert` which respectively always use `_assert` and `_wassert`?

- Kirill Makurin

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

Reply via email to