[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

Antti Haapala report at bugs.python.org
Sun May 27 23:53:34 EDT 2018


Antti Haapala <antti at haapala.name> added the comment:

Well, there's only one problem with casting to void *: while converting the function pointer to another *is* standard-compliant, and GCC is being just hypersensitive here, casting a function pointer to void * isn't, though it is a common extension (http://port70.net/~nsz/c/c11/n1570.html#J.5.7).

Pedantically the correct way is to cast to a function pointer with no prototype (empty parentheses) and from that to the target type. See for example. See for example https://godbolt.org/g/FdPdUj

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33012>
_______________________________________


More information about the Python-bugs-list mailing list