On Fri, 21 Aug 2015, Torbjörn Granlund wrote:

"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes:

 Maybe we can "promise" the right type, by adding an explicit cast?
 SIZ((mpz_srcptr) NUM(op2))

Except that we should cast op2, not NUM(ops).

I am not sure Marc's reasoning is accurate, nor am I suggesting it is
not, I've forgotten this level of detail of the C standard.  I am not
too enthusiastic about passing the wrong type, but if we add casts both
when going to &mpq and when going back to &mpz, I cannot see how that
could break with a conforming compiler.

Good point. I agree that (mpz_srcptr)op2 is a safer way to do the same thing as NUM(op2) in this case.

(I am not suggesting changing the gmp-impl implementation of NUM to a cast)

--
Marc Glisse
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to