Hi, 2012/5/26 Mickaël THOMAS <micka...@gmail.com>: >> Type quint8 is an unsigned byte so I think that char is better solution. >> http://qt-project.org/doc/qt-4.8/qdatastream.html#operator-lt-lt-3 > > What do you mean by "char is a better solution" ? >
Precision and range of a variable is the same. > q(u)int8 is supposed to represent an 8-bit (un)signed number, and the > documentation says "unsigned byte" too, it's not meant to represent a > char. Ok, so what is the difference between 8-bit unsigned int and 8-bit unsigned char? > The problem is that quint8 is typedef unsigned char which leads SIP to > convert it to a python bytes/str because python chars are one-long > strings. unsigned char could be also treated like one-long string. > SIP should be modified so that unsigned char is represented as a > python integer (signed char should be still converted to bytes) Why? I mean why usnigned char -> int is good but char -> int is bad? > _______________________________________________ > PyQt mailing list PyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt What about bigger numbers? How to represent 256? This method (QDataStream.writeUInt8) writes quint8 so what it should do: write 0x01 and 0x00, 0x00 and 0x01, just 0x00 or just 0x01? I think there is reason why in Qt you can not pass quint16 or something with bigger range to QDataStream.writeUInt8. Regards, Jarek _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt