[PyKDE] More on GCC 2.96

Johannes Sixt Johannes.Sixt at telecom.at
Wed Oct 11 20:56:23 BST 2000

On Wed, 11 Oct 2000, you wrote:
>Jesper Eskilson wrote:
>> When compiling PyQt using 2.96, I get the following error messages:
>> c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include/python2.0 -I/usr/local/include/sip -I/usr/local/qt-2.2.1/include -I/usr/X11R6/include -fno-exceptions -O2 -Wp,-MD,.deps/sipqtQWhatsThis.pp -c  -fPIC -DPIC sipqtQWhatsThis.cpp -o sipqtQWhatsThis.lo
>> sipqtQWhatsThis.cpp: In function `PyObject *sipNew_QWhatsThis (PyObject
>> *, PyObject *)':
>> sipqtQWhatsThis.cpp:1020: cannot convert `sipProxy *(*) ()' to `void *'
>> in initialization
>> One workaround is to add an explicit cast to (void *), but there seems to
>> be a lot of places where this needs to be done, and most of them are in
>> automaticall generated code (by sip). I tried to hack sip to emit the
>> void-cast directly, but the files above does not seem to be re-generated
>> when building PyQt.
>Is it invalid C++ to assign something to a void * without a cast? (I
>know its invalid to do the reverse.)

It is only allowed to cast pointers to objects to void*, but not pointers to
functions. You need a reinterpret_cast<void*>(xyz) to cast in one direction,
and a reinterpret_cast<sipProxy*(*)()>(zyx) to convert the value back. (But you
better think over the whole construct again - do you really require such dirty
hacks? Can't you get away with a union {}? That would be slightly cleaner.)

-- Hannes

>PyKDE mailing list    PyKDE at mats.gmd.de

More information about the PyQt mailing list