Quote Originally Posted by yeye_olive View Post
If you use QDataStream to serialize, you must use QDataStream to deserialize.
Hmm, I'll have that in mind next time... Manuals I read about using QDataStream to serialize structures to QByteArray and vice-versa didn't mentioned this.

Quote Originally Posted by yeye_olive View Post
By the way, your code should not depend on the precise layout of the serialized data. Just let QDataStream encode and decode, or design your own format as I explained before. Also, do not use types such as "unsigned int" in your structure because the range of values of this type depends on the architecture. Use a fixed-size type such as uint32_t.
To be honest, I never actually understood this point. For instance, if I go to stdint.h I'll find
Qt Code:
  1. typedef unsigned int uint32_t;
To copy to clipboard, switch view to plain text mode 

Which means that there is no difference between I writing my code with unsigned int or uint32_t, since they are the same. If a difference in architecture appears between two different projects, they will do wrong independent on the name I use since they will be synonyms. Of course, for clarity purposes, it's still worth the use of the typedef nomenclature.

Thanks,

Momergil