[Fwd: Re: new mpfr release]

Brian Hurt bhurt at spnz.org
Thu Sep 25 11:34:26 CEST 2003


On Thu, 25 Sep 2003, Vincent Lefevre wrote:

> On 2003-09-25 12:32:47 +0200, Patrick Pelissier wrote:
> > Why don't add for mpz/mpq/mpfr the varargs list version of 
> > init/init2/clear ?
> > 
> >   	mpx_t x, y, z, a, b, c;
> >   	mpx_init_s (x, y, z, NULL);
> >   	mpx_init2_s(50, a, b, c, NULL);
> > 	...
> >   	mpx_clear_s (x, y, z, a, b, c, NULL);
> 
> except that NULL must be casted to a pointer type (in the case
> it is not a pointer), or something equivalent.
> 

Why not just pass the number of variables being passed in?  For example:

mpx_init_s(3, x, y, z);

Instead of:

mpx_init_s(x, y, z, NULL);

?

This sidesteps the need for a null value altogether.

As for the programming problems, like accidentally writting:

mpx_init_s(2, x, y, z);

You get these no matter what you do, if you have varargs.  Consider:

mpx_init_s(x, y, z); /* opps, forgot the NULL! */

Brian




More information about the gmp-devel mailing list