Gabriel Dos Reis
gdr at integrable-solutions.net
Fri Nov 10 23:27:50 CET 2006
David Fang <fang at csl.cornell.edu> writes:
| > [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>
If you know you're using a C++ compiler, then <stddef.h> gives you size_t.
If it does not, then the compiler is broken beyond repair and you have
worse problems to worry about.
If you use <cstddef> then you start asking for troubles because,
unfortunately, they are still C++ compilers out there that do not
properly put inherited C-headers in namespace std. Consequently, as
far as C headers go, in particular <stddef.h> I would recommend you
just stick to the traditional <stddef.h>.
More information about the gmp-bugs