[Development] Weird offseting in QDataStream
André Somers
andre at familiesomers.nl
Fri Nov 8 13:37:40 CET 2013
Andreas Aardal Hanssen schreef op 8-11-2013 13:28:
> On 08 Nov 2013, at 12:41, Yves Bailly <yves.bailly at laposte.net
> <mailto:yves.bailly at laposte.net>> wrote:
>>> ]I would recommend against using QDataStream for anything else than
>>> reading back what was written using QDataStream.
>> This is what I called a step backward.
>
> It's just stating a fact. QDataStream isn't a generic cross-framework
> class, it's not based on any standard. Its internal structure is
> completely undocumented.
Wrong. It *is* documented:
http://qt-project.org/doc/qt-4.8/datastreamformat.html
> It's compatible only with itself, and then, only with specific
> versions of itself. It even encodes the QDataStream format version in
> the stream itself.
No, it does not. You actually should set the version used explicitly in
both the reader and the writer code especially _because_ the version is
not in the data stream.
>
> So it's not a step backward. It's just a special-purpose class used
> for more than it's designed for.
>
> Personally I think using fstream or htons is perfectly fine. Both are
> portable, beyond what QDataStream does.
>
I think that creating some "raw" class is ridiculous. It will end up
looking very, very much like QDataStream, only supporting less data
types. Seems like a pointless excersise to me.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131108/9e03ad93/attachment.html>
More information about the Development
mailing list