On 20.12.2024 16:06, Martin Storsjö wrote:
On Thu, 19 Dec 2024, Pali Rohár wrote:

Do note that the w- functions currently default to using
_CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS, even if this conflicts with
what the C standards say about how it should behave. This is also the
default behaviour in MSVC, so for cross compatibility in code targeting
Windows, we've intentionally decided to match the MSVC behaviour rather than
hard sticking to the standard.

For msvcrt builds in C99+ mode, by default is used mingw stdio
implementation and its w- functions are correct, no legacy.

So switching from msvcrt builds to ucrt builds, w- functions are not
correct anymore.

It is correct? Should not we rather make consistent behavior?

I'm not entirely decided.


That's the usual dilemma: whether to prioritize MSVC compatibility (making porting from MSVC easier) or greater standards compliance (making porting code from non-Windows platforms easier). I don't think the w* functions are widely used outside Windows, so maintaining compatibility with UCRT seems preferable. Additionally, changing this now would break compatibility with older mingw-w64 versions.


More generally, I wonder if we could eliminate the __ms_* aliases from the CRT. Unless there's something I'm overlooking, we could define them as header-level aliases instead, like this:

_ACRTIMP int __cdecl __ms_printf(const char * __restrict__ , ... ) __MINGW_ASM_CALL(printf);


Thanks,

Jacek



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

Reply via email to