[Numpy-discussion] rewriting in C (was ANN: Masked Array...)
david at ar.media.kyoto-u.ac.jp
Sun Jan 21 01:04:30 EST 2007
Russell E. Owen wrote:
> I'm curious why the low level stuff is in C instead of C++? I would have
> thought that C++ templates and possibly even the standard template
> library would be a huge win for coding array-type classes.
I don't know the specifics for numpy, but C++ has huge problems compared
to C for code which is meant to be used by other languages: C++ has no
ABI standard, loading C++ classes dynamically through dlopen mechanisms
is difficult (it basically means rewriting a C api over C++, AFAIK).
Also, template are extremely difficult to use in a sensible way, and
many advanced tricks using templates are not well supported by often
used compilers (looking at boost sources for compiler specific
workaround would give you an idea); in numeric codes, template are
useful to have one implementation for all the C type availble (float,
double, int, etc...), but those are cases which can easily be generated
by code generator tools (like autogen; numpy is using its own).
There are cases where C++ is useful compared to C++; I don't think numpy
is one of them,
More information about the NumPy-Discussion