i’m interested in serializing my model objects to binary files, but i’m worried about cross-platform issues.
the simplest way to serialize objects – taking a pointer to the object and streaming sizeof() bytes – is certainly not a versatile solution. i’m afraid that it may even be compiler specific, as different c++ implentations are allowed certain freedoms with generated code.
another approach, streaming only the data from an object, will run into trouble as well, because primitive data types may vary in size from system to system depending on the size of a machine word, etc. endian issues also arise.
i am sure that other people have long ago solved these problems in various ways, and i’m interested in finding references to those solutions.