Arrays of large integers - pass by reference getting in the way
Wed, 27 Aug 2003 23:00:16 -0700
In my application, I need to be able to handle variable sized arrays of
mpz's. If mpz_t was a normal structure, I would just allocate the
memory that I need and use a normal array of structures. But the wierd
typedef that defines mpz_t seems to make this difficult, since you
can't assign one array to another. Is it OK to do something like this:?
mpz_t y, z;
x = calloc(n, sizeof(mpz_t));
x = y;
x = z;
mpz_mul(x, x, x);
I've read about mpz_array_init, but since there is "no way to free the
storage allocated by the function", I cannot use it.