I'm happy enough with the way that the gmp and mpfr libraries are building.
GMP has its own fallback (printf/repl_vsnprintf.c) to use when vsnprintf
is found to be unavailable or faulty in behaviour.
That fallback seems to work quite well for gmp, but mpfr does not adapt
perfectly to it.
However, that's not really a bug or defect in MPFR as their INSTALL file
says:
In order to have the MPFR formatted output functions based on an
ISO-conforming printf(), you need to compile GMP (not MPFR) with
CC="gcc -D__USE_MINGW_ANSI_STDIO" (since the standard printf modifiers
%e, %Ld and %td are passed to GMP).
If I stray from that, then I think it's up to *me* to clean up the mess.
And I have no objection to following that directive, anyway.
The only reason I stopped defining __USE_MINGW_ANSI_STDIO was that it
didn't appear to be doing anything any more.
And then I started using UCRT compilers, and have eventually realized that,
in at least some situations. it definitely *does* do something.
I wasn't expecting such a difference between UCRT and MSVCRT builds of gcc,
and just wanted to check that there was nothing amiss going on.
I think I can now say that there's no need for any concerns about that - I
should just follow the mpfr documentation and move on.
I'll outline the problem I struck, for anyone interested, though I think
it's off-topic to this thread:
Both GMP and MPFR have their own formatting functions - for example
gmp_printf and mpfr_printf.
These formatting functions are primarily there to format the values held
within the GMP and MPFR structs, but they should also handle formatting of
the usual C data types (longs, doubles, etc.).
So, for a given double precision variable called (say) "d", the following
3 pieces of code should all print the same thing to stdout:
printf("%a\n", d);
gmp_printf("%a\n", d);
mpfr_printf("%a\n", d);
And, if GMP was configured with __USE_MINGW_ANSI_STDIO defined, they all
work as expected.
But if GMP was configured *without* that symbol being defined (in which
case the repl_vsnprintf.c fallback is used) then "mpfr_printf("%a\n", d);"
simply outputs the error:
repl-vsnprintf.c:388: GNU MP assertion failed: len < total_width
Thank you for the replies.
Much appreciated.
Cheers,
Rob
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public