variable argument lenth mpz init

Kevin Ryde user42@zip.com.au
Sat, 28 Dec 2002 08:09:42 +1000


enders game <endersgame99@yahoo.com> writes:
>
> I tried
> passing the actual mpz_t variables, and printing the
> memory addresses, but I got copied mpz_ts and not
> pointers.  

I think you'll find "a" and "&a" give the same address passed.  It
might be easier to use "void *" in the mpz_init_va to see that.

This all comes from mpz_t being a one element array of a certain
structure, so as a variable it makes space but as a function parameter
it's a pointer.

I guess "va_arg (ap, mpz_t)" doesn't do what might be hoped.  It seems
to step by the size of the structure, not a pointer.

I guess we don't document "mpz_ptr".  "MP_INT *" as a throwback to gmp
1.x days would be a possibility.  Or forget about wimpy type checking
and use "void *".

Should put an example of this in the manual I suppose :).