[PyKDE] Special-case handling for default argument of NULL vs 0?

Nigel Stewart ns at fluent.com
Tue Feb 21 21:14:36 GMT 2006


Hi all,

We're observing some issues with methods such as:

(a)    void foo(const QString * = NULL);
(b)    void bar(const QString * = 0);

We're using Sip 4.3.2, it appears that Sip doesn't
support (a), PyQt 3.15.1 doesn't use (a) and the
yacc parser that sip uses is confusing NULL for
a C++ identifier that the address can be taken of:

static PyObject *meth_MyClass_foo(PyObject *sipSelf,PyObject *sipArgs)
...
		const QString * a0 = &NULL;       // Can't compile this!

static PyObject *meth_MyClass_bar(PyObject *sipSelf,PyObject *sipArgs)
...
		const QString * a0 = NULL;

So, the lesson seems to be that "= 0" is good, "= NULL" is
to be avoided, when it comes to sip bindings.

But, it would be nice if sip could recogise NULL as a special
case, since that is what we encourage in our C++ API, rather than
"0".

Any thoughts?

Cheers,

Nigel Stewart




More information about the PyQt mailing list