C++ and std::

Marc Glisse marc.glisse at normalesup.org
Mon Feb 23 07:51:32 CET 2009


Hello,

I know I pushed in favor of doing things cleanly for the C++ std 
namespace. I was _a bit_ idealistic... I decided to give up on that. This 
is not what gmp is about, and I can always maintain my own patch if it 
itches too much. I now believe the best way to avoid trouble is, as has 
been claimed by other people, something like the attached patch for 
gmp-h.in. I don't necessarily expect the patch to be applied, I just 
wanted to cancel what I said in the opposite direction on this mailing 
list.

By the way, it seems natural to include stdarg.h by default in C++ for the 
same reasons that stdio.h is included.

-- 
Marc Glisse
-------------- next part --------------
--- gmp-h.in.orig	2009-02-22 00:45:44.264364913 +0100
+++ gmp-h.in	2009-02-22 00:51:21.688543331 +0100
@@ -22,7 +22,8 @@
 
 #if defined (__cplusplus)
 #include <iosfwd>   /* for std::istream, std::ostream, std::string */
-#include <cstdio>
+#include <stdio.h>
+#include <stdarg.h>
 #endif
 
 
@@ -46,13 +47,7 @@
 #ifndef __GNU_MP__
 #define __GNU_MP__ 4
 
-#define __need_size_t  /* tell gcc stddef.h we only want size_t */
-#if defined (__cplusplus)
-#include <cstddef>     /* for size_t */
-#else
 #include <stddef.h>    /* for size_t */
-#endif
-#undef __need_size_t
 
 /* Instantiated by configure. */
 #if ! defined (__GMP_WITHIN_CONFIGURE)
@@ -517,7 +512,6 @@
 
 #if defined (__cplusplus)
 extern "C" {
-using std::FILE;
 #endif
 
 #define mp_set_memory_functions __gmp_set_memory_functions


More information about the gmp-bugs mailing list