gmp_printf and mingw for stdint format macros
Niels Möller
nisse at lysator.liu.se
Thu Jan 8 14:35:10 UTC 2015
Emmanuel Thomé <Emmanuel.Thome at inria.fr> writes:
> The reason is along the following lines. PRIu64 gets substituted to the
> microsoft-specific "I64u". This is undefined behaviour in ISO C.
> gmp_printf is not aware of this specificity, and steps over this
> unrecognized "%I64u" silently (line 600 in doprnt.c, since the ASSERT(0)
> expands to nothing).
[...]
> It's not clear to me whether there is something to change, and what.
It would make some sense to me to abort with an error message or
ASSERT_ALWAYS(0) or something for format specifiers which aren't
recognized. Silently ignoring an unknown format specifier is rarely
going to be helpful.
> Maybe allowing gmp_printf("%" PRIu64" %Zd\n", a, b) to work correctly
> would be a reasonable goal,
One could compare the format string to the constant PRIu64 (and other
related constant strings). Sounds like a bit of work, but I don't seen
any obvious reason why it couldn't be made to work correctly and
reliably.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-bugs
mailing list