[Numpy-discussion] void * abuse

Charles R Harris charlesr.harris@gmail....
Fri Jan 22 15:02:39 CST 2010


Example:

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
simple

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.

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


More information about the NumPy-Discussion mailing list