[Qt-interest] QDataStream backwards incompatibility introduced in 4.6
Lene Preuss
lene.preuss at googlemail.com
Fri Jan 22 14:55:49 CET 2010
On 01/21/10 16:24, André Fillipe wrote:
>
> 0.0078125
> 0
> 0
> not, as you might expect,
> 1.0
> 0.429043
> 1.2
>
>
> Why would this be expected behavior? The writeFile and readFile
> functions use different stream versions. Floats written by Qt 4.5
> are correctly read by Qt 4.6 if the stream version is set
> appropriately. Am I missing something?
Well, it would be expected because programs linked against 4.5 stop
working if you upgrade Qt to 4.6 - if the authors haven't used
setVersion() on their QDataStreams in the first place.
Now the documentation for QDataStream mentions that the format in which
QDataStream stores data may change and you should explicitly use
setVersion(), but only for complex data types. This may be open to
interpretation, but i don't consider floats a complex data type. I
suspect many programmers would share that view.
The upshot of this is, upgrading Qt to 4.6 may break existing programs.
If you wish, you can consider these programs as sloppily written - but
in any case, it should be noted that breakage may occur.
Greets, Lene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100122/59ee5844/attachment.html
More information about the Qt-interest-old
mailing list