c++ patch

David Fang fang at csl.cornell.edu
Fri Nov 10 18:06:42 CET 2006

> [long patch snipped]
> I wonder if we need to support every C++ compiler with gmp.h.  If C++
> doesn't provide the size_t type, I think we will re-introduce
> incompatibilities with those compilers, whenever we hack gmp.h.

	With respect to missing built-in size_t, I don't know if the
compiler is at fault or the headers are at fault.  Just testing
AC_CHECK_SIZEOF(size_t) on different systems with the same compiler
version (only variant by vendor) gives me different results (not just 4
vs. 8, but 0 for missing).  In my own sources, I do something similar to
the patch (attached to the start of this thread) to #include <cstddef> for
size_t where needed, and that's solved C++ portability issues w.r.t.
size_t.  The alternative, of course, is just to include <cstddef>

> Perhaps we should instead declare exactly what gmpxx.h needs from
> gmp.h, in gmpxx.h, in a syntax every C++ compiler might understand?
> The only thing we need, are prototypes for the C functions used from
> gmpxx.h, right?


David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
	-- (2400 baud? Netscape 3.0?? lynx??? No problem!)

More information about the gmp-bugs mailing list