Hi all,

I am going to change how we deal with the functions mpz_get_ux, mpz_set_ux,
mpz_get_sx, mpz_set_sx.

As you are aware, these require intmax_t to be available, which in
practical terms means that stdint.h needs to be available.

Determining when stdint.h is available is for the most part easy, due to
the autoconf macro HAVE_STDINT_H, and with MSVC one just looks at the MSVC
version number.

However, the autoconf solution doesn't work for gmp/mpir.h since the latter
does not include config.h (nor can it).

Currently we are checking if _STDINT_H, STDINT_H or _STDINT_H_ are defined.
But this is non-portable. For example, it doesn't work on OpenBSD. So this
has to be changed.

One potential solution would be to have configure substitute macros in
gmp-h.in when creating mpir/gmp.h. But this doesn't work when cross
compiling.

After much thought, the solution finally occurred to me late last night.

Throughout the MPIR library itself, we can continue to use the autoconf
macro HAVE_STDINT_H. The only problem is gmp/mpir.h itself.

What I now propose is that mpz_{get,set}_{ux,sx} are only exported by
gmp/mpir.h if the user included stdint.h first. In otherwords, it won't be
up to us to check the availability of stdint.h, but the user.

In our test code (which currently fails on lots of platforms), we will
check the autoconf macro HAVE_STDINT_H to see if stdint.h is available for
that platform. If it is, we will include it before including mpir.h and
test the ux/sx functions. If not, the test will be skipped.

This is clearly the correct solution, which I will now implement. I'm
making a note of it here, since it may affect some external projects that
have been using these functions.

Bill.

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mpir-devel+unsubscr...@googlegroups.com.
To post to this group, send email to mpir-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/mpir-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to