mpz_class initialization

Dmitry Panteleev dpantele at dpantele.com
Mon Mar 11 18:40:04 CET 2013


Thank you for correct references. Now I know the term which I have to
google.

Is there any primary point where lazy initialization is discussed?
11.03.2013 13:16 пользователь "Marc Glisse" <marc.glisse at inria.fr> написал:

> On Mon, 11 Mar 2013, Dmitry Panteleev wrote:
>
>  For some reason mpz_class is initialized with 1-bit length assigned. Why
>> it
>> is not just zero-initialized, as soon as most(or all?) algorithms works
>> well with such variables? It would be better for move semantics, which is
>> now supported in gmp. Also then it will be possible to make default
>> constuctor return constexpr.
>>
>
> This is discussed regularly on the GMP lists, sometimes as lazy
> initialization. Most functions are not currently ready for this, but it
> might happen some day. Most of the work needed is in the C layer, adapting
> the C++ wrapper would then be rather simple.
>
> Boost.Multiprecision's mpz wrapper has a slightly different approach here,
> if you want to compare.
>
> --
> Marc Glisse
>


More information about the gmp-discuss mailing list