On Tuesday 18 November 2025 12:21:23 Pali Rohár wrote:
> On Tuesday 18 November 2025 12:17:06 Pali Rohár wrote:
> > On Tuesday 18 November 2025 10:18:33 LIU Hao wrote:
> > > 在 2025-11-17 23:16, Martin Storsjö 写道:
> > > > I had a few comments on commit message and comment wordings here.
> > > > 
> > > > Other than that, this looks reasonable to me. I think this is the most 
> > > > consistent way forward.
> > > > 
> > > > However in practice, there's a moderately high chance that this will
> > > > break existing code (for all the code that is built with
> > > > __USE_MINGW_ANSI_STDIO=1, which is the default for most configurations
> > > > with msvcrt.dll, and with UCRT you'll also get this if you e.g. include
> > > > libstdc++ headers). Like, I'm quite sure that this will break some
> > > > user's code.
> > > > 
> > > > But on the other hand, our current state is inconsistent, so this does 
> > > > make things better.
> > > > 
> > > > What do Liu Hao and Jacek think about it?
> > > 
> > > As stated in a message last month, I think we had better not touch the %S
> > > part. At the moment it conforms to C99, so there's no sufficient reason to
> > > make a change.
> > 
> > C99 does not specify %S format, here it is MS extension.

What I wanted to say in previous email is that %S format is not in C99,
it cannot conforms to C99 and hence it is MS extension. If the Windows
application is using %S then probably would conform to MS extension
behavior.

Also in mingw-w64 is inconsistency between __USE_MINGW_ANSI_STDIO=1 and
msvcrt and ucrt builds, so any application which targets mingw-w64 (not
the MS) has problems with using this format.

As Martin said it can break user's code. But it is already inconsistent
between mingw-w64 builds and also is not compatible with MS behavior. So
basically it is broken.

> > And in any case, is there any reason why not to support h and l
> > modifiers for %S format (%hS and %lS)? I was somehow expecting that
> > mingw-w64 printf implementation would support all possible modifiers
> > supported by msvcrt, UCRT, C99 and GNU.
> > 
> > > I'm interested by the %Z change. However, <ntdef.h> is a kernel header and
> > > may cause conflicts with other SDK headers; maybe <winternl.h> should be
> > > included instead.
> > 
> > I looked at the https://learn.microsoft.com/en-us/windows/win32/api/ntdef/
> > and seems that it is really kernel header. I thought that ntdef.h is
> > normal header as it is not in the mingw-w64-headers/ddk/include/ddk/
> > like others kernel header files.
> 
> I replaced the #include <ntdef.h> by #include <winternl.h> in
> mingw-w64-crt/stdio/mingw_pformat.c and it compiled in the same way.
> So it is OK to use winternl.h.

I can send a new version with this replacement.

> > Should not be all kernel headers in mingw-w64-headers/ddk/include/ddk/
> > directory?


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

Reply via email to