[PyKDE] SIP and unsigned int

Phil Thompson phil at riverbankcomputing.co.uk
Tue Feb 21 15:56:16 GMT 2006


On Tuesday 24 January 2006 4:12 pm, Ulrich Berning wrote:
> Hi,
>
> SIP (tested with snapshot-20060120) doesn't handle unsigned int
> correctly. SIP treats unsigned int the same as signed int and I think,
> this is wrong.
> While 4294967295 (0xffffffff) is a legal unsigned int value (on machines
> where the size of int is 32 bit of course), it is not a legal signed int
> value. The maximum legal signed int value is 2147483647 (0x7fffffff).
>
> How should I wrap a function/method, that takes/returns unsigned int's
> in the full range?
> I could replace every occurence of unsigned int with unsigned long, but
> if you are wrapping a large number of functions/methods, this is
> annoying. If you have functions/methods that take pointers to unsigned
> int, you have lost. Changing unsigned int* to unsigned long* gives me
> compiler errors.
>
> See the attached code:
>
> uinttest.h contains the definition of the class Test containing two
> member functions.
> uinttest.cpp contains the implementation
> uinttest.sip is the SIP file (look at the comments there)
> test.py is a test script
>
> I think unsigned int should be handled like unsigned long, but I can't
> say, if this would break existing code.

Implemented in tonight's snapshots - but untested.

Phil




More information about the PyQt mailing list