Extra zero byte converting mpz_t to a string

tg at gmplib.org tg at gmplib.org
Sat Apr 18 11:40:58 UTC 2015


Dmitry Antipov <dmantipov at yandex.ru> writes:

  for some strange reason, an attached program outputs an unwanted
  trailing zero byte for 6!, 14!, 24!, 29!, 31!, 33!, 40!, 52!, 60!,
  65!, 66!, 71!, 79!, 81! and 96!-100! (full output is also attached).
  
You output a zero byte on your loop.  Why don't you use a simpler and
much faster string output function like e.g., puts?  It will also
correctly stop at the C string termination null byte.

No GMP bug, bug in user program.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list