Perhaps question has been raised before, but I would venture.
As mentioned on https://sourceforge.net/p/msys2/wiki/Porting/ :
"The vc6.0 msvcrt.dll that MinGW-w64 targets doesn't implement support for the ANSI standard format specifiers. MinGW-w64 works around this by providing their own implementation. To enable this you should pass -D__USE_MINGW_ANSI_STDIO=1 to the MinGW-w64 C and C++ compilers."
On the other side, the L modifier has been standard for a long time (it was added in ISO C89).
The expected output for printf test
#include <stdio.h>
int main (void) {
long double d = 1. / 31.;
printf ("%Lf\n", d);
return 0;
}
is 0.032258. Tested with:
My question, what keeps MinGW-W64 developers from targeting MinGW-W64 to more recent MSVC runtime 'msvcrt.dll' and move "-D__USE_MINGW_ANSI_STDIO" to trash? After all very unlikely, that someone needs backward MinGW-W64 compatibility with non-working 'L' length modifier for formatted output (e.g. printf with %Lf) and inconsistency to ISO C89.
Thanks!
Controlling which version version of MSVCRT.DLL the user has is out of the scope of this project.
Well, I rephrase my question: what keeps MinGW-W64 developers from making MinGW-W64 with full compliance to ISO C89 by default and move "-D__USE_MINGW_ANSI_STDIO" to trash?
UPD: You have closed the topic even before posted a reply. Whether you do not have to clarify the issue even if question contains inaccuracies?
Last edit: sav 2015-12-16
This is not a bug, not in the slightest, it is meant to work this way. The macro means using mingw-w64's own copy of printf routines instead, nothing to do with C99 compatibility, though that is one of the main side effects.
As you may not know, the reason %LF works in MSVC but not on mingw-w64 even on modern systems is because long double in MSVC is an alias to double, while gcc is using the longer 80-bit variant, with mingw_printf being able to handle it via %LF.
So no, assuming MSVCRT is C99 compliant does not magically fix everything, not until you can petition Microsoft to break ABI compatibility with all their existing releases.
Thanks for a comprehensive answer!