documentation of mpz_ptr and mpz_srcptr

Marc Glisse marc.glisse at normalesup.org
Tue May 26 19:42:51 CEST 2009


On Tue, 26 May 2009, Torbjorn Granlund wrote:

> I think I need stronger arguments for introducing a new type than that
> you can omit a measly ampersand in assignments.  :-)

I can understand that...

>  I admit that I also find it clearer to use mpz_ptr and mpz_srcptr
>  instead of mpz_t and const mpz_t for the argument and return types of
>  a function...
>
> I am not sure I agree.  Using the same type for formal and actual
> parameter is probably clearer for most users.  Understanding the
> semi-compatibility of mpz_t and mpz_ptr requires more insight into the
> wonders of C and C++ than most users have.

Although this means I can't have a function return such a type (returning 
an array does not work, and the pointer type is not documented). So for 
instance a C++ interface other than gmpxx (which is allowed to cheat) 
can't have a function like get_mpz_t() which returns a pointer to its 
integer (I can work around it but it is not as convenient).

I guess "unlikely to break" will have to do.

Thank you,

-- 
Marc Glisse


More information about the gmp-discuss mailing list