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

David M. Cooke cookedm at physics.mcmaster.ca
Tue Nov 22 11:18:47 CST 2005


On Nov 22, 2005, at 11:49 , Andrew Straw wrote:

> Sorry, my mistake! It turns out that OpenProducer (part of
> OpenSceneGraph) must do "typedef int Bool", and so this, combined with
> arrayobject.h's "typedef undefined char Bool" results in the
> "redeclaration of int" compiler error.  So, you're right, Bool is not
> defined in C++, and its probaby safest to remove my patch.  But  
> would it
> make sense to rename Bool to ScipyBool or something less likely to
> defined in other source?

This is the reason for PY_ARRAY_TYPES_PREFIX. If you do this:

#define PY_ARRAY_TYPES_PREFIX Scipy
#include "scipy/arrayobject.h"

then all the types that scipy defines will have Scipy prefixed (so  
ScipyBool, Scipybyte, Scipyuint, etc.).

> Travis Oliphant wrote:
>> Andrew Straw wrote:
>>> Bool is defined in C++ compilers, so if arrayobject.h defines  
>>> Bool, the
>>> compiler issues an error: "redeclaration of C++ built-in type  
>>> `int'".
>>>
>> I thought C++ defined bool.   This was recently changed from bool to
>> Bool precisely for C++ compilers.  Now you tell me that C++ compilers
>> define Bool as well?
>>
>> The problem with the patch is what is sizeof(Bool) on those C++
>> compilers?  Is it 1?

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the Scipy-dev mailing list