bug in gmp_fprintf?
nisse at lysator.liu.se
Tue Nov 24 08:54:31 UTC 2015
tg at gmplib.org (Torbjörn Granlund) writes:
> I didn't look where the callback ends.
Unless there's some re-defines somewhere I'm missing, it's fgetc
> Unfortunatly, getc_unlocked is POSIX, not C90, so unless we've found it
> to be supported everywhere in practice already, we might run into
We'd need a configure test. Falling back to plain fgetc should be no
problem, except worse performance.
Another alternative might be to use fscanf with a conversion specifier
like "%[allowed digits]", and leave the per-char loop and any
getc_unlocked dancing to the C library.
It might make sense to not allocate storage for the the complete digit
string, but read blocks of at most a few thousand digits at a time, and
do bignum mul per block.
> I don't think we need to lock the stream.
I guess it's still good practice to do. But probably less important for input
streams than output streams; multiple threads reading from the same
stream is unlikely to work well anyway.
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-bugs