On Tue, 16 Jan 2024, Antonin Décimo wrote:

Le lun. 15 janv. 2024 à 23:01, Martin Storsjö <mar...@martin.st> a écrit :

On Fri, 12 Jan 2024, LIU Hao wrote:

在 2024/1/11 23:41, Antonin Décimo 写道:
The non-suffixed macro GetModuleHandle depends on whether the file is
being compiled in Unicode mode or not. Prefer using the char string
literal in this simple case.

Signed-off-by: Antonin Décimo <anto...@tarides.com>
---
  mingw-w64-libraries/winpthreads/src/misc.c   | 2 +-
  mingw-w64-libraries/winpthreads/src/thread.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


In my opinion the W variants should be preferred. Most A functions convert
their arguments to wide strings then call their W variants anyway.

I don't have a strong opinion on this matter. However, I have a very faint
memory, that such unicode functions were absent in the Win9x series - I'm
looping in Jonathan who posted the patches for making winpthreads work on
Win98 recently. So if it makes a difference for Win98, I'd prefer going
with the -A version, otherwise I don't have a strong opinion, and don't
mind going with the -W version.

Or maybe going with GetModuleHandle(TEXT("kernel32.dll")) is just
simpler and we leave it to users to define UNICODE or not?
All the other strings in winpthreads are format strings given to
printf/fprintf, so there's not much to stress about. I could also
convert these to TCHAR and tprintf.

I don't think it's worth that - it just adds one potential hidden source of variability in the builds, for little extra benefit. I agree with LIU Hao's argument for preferring the -W form, if all things are equal, but here we have a specific argument for using the -A form, so I think we should just go with that for simplicity then (the argument strings are fixed so there's no need for unicode anyway).

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to