[PATCH] support for mingw-w64

Torbjorn Granlund tg at gmplib.org
Fri Sep 11 14:05:17 CEST 2009


nisse at lysator.liu.se (Niels Möller) writes:

  Torbjorn Granlund <tg at gmplib.org> writes:
  
  > * We unfortunately cannot use intptr_t unconditionally, since it is not
  >   available everywhere we want GMP to work; it is a C99 feature.
  >
  >   I wonder if size_t could be used instead?  While perhaps not elegant,
  >   it should work.  Does anybody see any problem?
  
  Another alternative is ptrdiff_t. My understanding is that this is
  fairly portable in both theory and practice.
  
My undertanding is that sizeof(ptrdiff_t) == sizeof(size_t) should hold
true on any ISO C90 or C99 system.  They only differ in signedness.

Perhaps some usages of ptrdiff_t could make use of the sign ("which
sub-object within the objext comnes first in memory?"), but I doubt GMP
will care.

I suggest that we either use size_t, or if people think ptrdiff_t make
more sense, use that.  But we might as well use a typedef in gmp-impl.h:

typedef size_t gmp_intptr_t;

-- 
Torbjörn


More information about the gmp-devel mailing list