[Numpy-discussion] void * abuse

Charles R Harris charlesr.harris at gmail.com
Fri Jan 22 16:02:39 EST 2010


typedef void (PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *,
void *)

The actual functions that implement this type don't match the prototype, an
unfortunate fact that is papered over by casting said functions to the type
to avoid warnings about initialization from incompatible pointer types.
Theoretically real problems could result from this, in practice the main
effect is that type checking by the compiler doesn't take place leading to
undisciplined implementions. The current prototype isn't much better than a

typedef void (PyArray_VectorUnaryFunc)()

So... this can be fixed but the fix could cause some current code in the
wild to result in some warnings next time it is compiled. I doubt there will
be any binary incompatibility with existing compiled code. Should I fix it?
It is really ugly as it stands.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100122/482a3428/attachment.html>

More information about the NumPy-Discussion mailing list