[Numpy-discussion] C-API change for 1.2
David Cournapeau
cournape at gmail.com
Mon Aug 18 22:49:10 EDT 2008
On Mon, Aug 18, 2008 at 10:04 AM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>If you could figure out how to add a new flags field
> without affecting the old one or requiring existion applications to be
> recompiled, that would be good.
Adding a member to a struct does not break ABI as long as the struct
is not used in another struct (or you could use something like C++
pimpl: using struct inside struct is how inheritence is implemented by
most compilers I believe in C++, and pimpl is often used to add
members to inherited classes).
> We also need to distinquish between internal
> and external ABI's.
What is internal and external ABI ?
> One way to avoid the problems like this is to put some
> "spares" in the original structure to reserve space for future enhancements.
If pimpl can be used in C python, I think it is better to use this
than reserving space.
http://en.wikipedia.org/wiki/Opaque_pointer#C.2B.2B
I still don't know enough about C internals of numpy, but I believe
both would break a lot of code at the API level.
> It can also be useful to use getters and setters, ala C++, in the interface.
Yes, that's basically what the pimpl principle is about. But it breaks
ABI and API (see gtk 3.0 discussion for the same kind of problems).
http://tirania.org/blog/archive/2008/Jul-14.html
http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
cheers,
David
More information about the NumPy-Discussion
mailing list