[Development] Weird offseting in QDataStream

Yves Bailly yves.bailly at laposte.net
Fri Nov 8 12:41:21 CET 2013


On 08/11/2013 11:37, Andreas Aardal Hanssen wrote:
> On 08 Nov 2013, at 11:32, André Somers <andre at familiesomers.nl> wrote:
>> Eskil Abrahamsen Blomfeldt schreef op 8-11-2013 11:20
>>> QDataStream supports reading and writing floats and doubles, but it
>>> might use more bytes than necessary to represent them in the stream.
>>>   the main ...
>> I don't see what's wrong with such a mode, as long as the documentation
>> warns that it won't work reliably with qreal (before 5.2, I read). You
>
> To me it sounds like Qt needs a new lower-level class for serializing and deserializing stuff.

A "QRawDataStream" class, but keeping the ease-of-use :-) mostly the "setByteOrder()" in my
case. Otherwise there's no added value compared to the standard std::fstream.

> QDataStream is for Qt only, it’s incompatible with all other binary formats out there, with the undocumented exception for cases where primitive types match.

Then maybe it should be stated more clearly in the doc? A big red blinking warning "don't use QDataStream for
anything else than to and from itself"...

> 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.

Regards,

-- 
(o< | Yves Bailly                          | -o)
//\ | Linux Dijon  : http://www.coagul.org | //\
\_/ |                                      | \_/`



More information about the Development mailing list