James E. King, III wrote:
This leads me to wonder if serialization is compatible across platforms and if it is *supposed *to be compatible across platforms. Is this a bug?? Shouldn't binary serialization be the same size on every platform, assuming platform-specific types are not used?
As far as I know, the built-in binary archives are completely platform-dependent, in both size and endianness. It should be possible to create portable ones based on Endian's buffer types, one just needs to choose an appropriate size for 'int' (32 bits would probably be fine here) and 'long' (32, 48, or 64? hard to say.) Another approach is to make the portable archives only take uintN_t. This takes care of the size, but since those types are typedefs, if you serialize an int, you still get a non-portable result. Myself, I prefer to use the basic types.