[SciPy-dev] patch: allow arrayobject.h to compile in c++ compiler

Andrew Straw strawman at astraw.com
Tue Nov 22 01:20:12 CST 2005


Bool is defined in C++ compilers, so if arrayobject.h defines Bool, the
compiler issues an error: "redeclaration of C++ built-in type `int'".

And, in an apparent shortcoming of Trac, I can't seem to submit a
patch.  Is that really so?

Here's a patch which allows C++ source to be compiled against
scipy/arrayobject.h:

Index: scipy/base/include/scipy/arrayobject.h
===================================================================
--- scipy/base/include/scipy/arrayobject.h      (revision 1517)
+++ scipy/base/include/scipy/arrayobject.h      (working copy)
@@ -103,7 +103,9 @@
 #  define ULONGLONG_SUFFIX(x) (x##UL)
 #endif

+#ifndef Bool
 typedef unsigned char Bool;
+#endif
 #ifndef FALSE
 #define FALSE 0
 #endif




More information about the Scipy-dev mailing list