_ptr and _srcptr types

Torbjörn Granlund tg at gmplib.org
Wed May 16 11:37:25 UTC 2018


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  If I understand correctly what Vincent underlines with his message, we
  should explain that both the macros mpq_{num,den}ref and the return value
  of mpz_roinit_n are intended for direct use as arguments of mpz functions.
  The former with a possible read-write role, the latter for read-only uses.

Yes, that seems necessary.

I also think usage of mpz_roinit_n might lead to memory leaks, triggered
by mpz_init (or lack of mpz_clear) before its use.  We need to point
this out.

  I believe that both types will not change their role or definition in the
  near future, as such they can be documented.
  I'm not sure about: how we should explain how to use them.

That is a challenge.  At the minimum, we should make it clear that they
should only be used by advanced users.  (Should we provide similar types
for mpq and mpf?)

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


More information about the gmp-devel mailing list