[Development] Weird offseting in QDataStream

Andreas Aardal Hanssen andreas at hanssen.name
Fri Nov 8 13:28:55 CET 2013


On 08 Nov 2013, at 12:41, Yves Bailly <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. 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.

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.

Andreas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131108/dcecd892/attachment.html>


More information about the Development mailing list