_ptr and _srcptr types

Marco Bodrato bodrato at mail.dm.unipi.it
Mon May 14 17:13:46 UTC 2018


Ciao,

Il Lun, 14 Maggio 2018 1:58 pm, Torbjörn Granlund ha scritto:
> Emmanuel Thomé <Emmanuel.Thome at inria.fr> writes:
>
>   ~/gmp $ grep 'mp[a-z]*_[a-z]*ptr' doc/gmp.texi
>   @deftypefun mpz_srcptr mpz_roinit_n (mpz_t @var{x}, const mp_limb_t
> *@var{xp}, mp_size_t @var{xs})

> The return type there is not something we should, it's not how other GMP
> functions work.

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.

e.g. mpz_addmul (mpq_numref (q), mpq_denref (q), mpz_roinit (t, np, ns));

>   I've personally always used the mpz_ptr and mpz_srcptr in functions that
>   take mpz arguments, taking the liberty to use this undocumented type.
>
> I suppose we could declare these.  I'd like to hear from the rest of the
> GMP "core team".

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.

Ĝis,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list