1 Aug 2011 15:39
public typedefs for gmp malloc/free types
Marc Glisse <marc.glisse <at> inria.fr>
2011-08-01 13:39:52 GMT
2011-08-01 13:39:52 GMT
Hello,
the following is a common use of gmp:
void (*gmp_free) (void *, size_t);
mp_get_memory_functions (NULL, NULL, &gmp_free);
(*gmp_free) (str, strlen (str) + 1);
which is valid in C, compiles with g++, but is invalid in C++ proper. For
this reason, we have in gmpxx.h:
extern "C" {
typedef void (*__gmp_freefunc_t) (void *, size_t);
}
so we can declare:
__gmp_freefunc_t gmp_free;
Now, I have to introduce this same fix in CGAL and in GCC. I believe it
would be good if gmp provided an official, documented typedef for the
types of the malloc/realloc/free functions it uses.
Possibly gmp_malloc_t/gmp_realloc_t/gmp_free_t, but I really don't care
about the name.
What do you think?
--
--
Marc Glisse
(Continue reading)
RSS Feed