documentation on internals not up to date

Marc Glisse marc.glisse at
Fri Apr 27 09:10:56 UTC 2018

On Fri, 27 Apr 2018, Niels Möller wrote:

>>> _mp_alloc == 0 and _mp_size != 0 is a read-only value, _mp_d is neither
>>> written, reallocated or freed by mpz functions. It must not be passed as
>>> destination argument to any mpz function. Should also link to docs for
>>> mpz_roinit_n and MPZ_ROINIT_N.
>> Currently, if an mpz_t is initialised with _roinit, it can be passed to
>> _clear or _clears with no errors. Should we document this? I think we
>> should.
>> Moreover, the various mpz_set_ functions should work smoothly too.
> I'd prefer that we not document any way to pass _roinit values to any
> mpz functions taking a non-const mpz_t, even if it happens to work in
> the current implementation. Maybe as a later extension, *if* we find
> some use cases where it provides a significant advantage.

There would be a significant advantage to mpq if we could have a
non-allocated 1 for the denominator. But indeed, with the current code 
where only some mpz functions would work, it seems safer to document that 
none work.

Marc Glisse

More information about the gmp-devel mailing list