How would you serialize from one format to a different one without breaking it down into "portably small" chunks?
Of course you have to define the 128 bit integer in terms of some other types. But THOSE types should already be portably serializable.
Sure, but as I said, exactly what those types are, and how many of them there are, changes from one platform/compiler to another.
another way to deal with this is to work a at a more primitive level. By marking the 128 integer type as "primitive" and defining an output for output/input stream operarate - text archives should "just work". Of course these operators will have to be implemented with portability in mind so the issue is moved to somewhere else. But then one probably needs to define these operators in any case so for text archives serialization comes for free.
You mean rely on the usual streaming << >> operators? For sure I could do that, but full string conversion is crazy expensive compared to the byte-by-byte scheme I have now.
for binary and portable binary archives, one might need to specialize the serialization operators. For binary archives there's not much if anything to do. For portable binary archives, one might have to make a minor specialization. The portable binary archive includes code for handling endianness of arbitrarily long integer types. (note that portable binary archive isn't complete in anycase in that it doesn't handle floating point types - a good GSOC project if one wants one.)
I already specialize for binary archives and just write out the bytes.
So you've got a couple of ways of addressing this.
Thanks, but now I've tested what I have (and verified that the archives are truly portable at least for 32 and 64 bit systems), I'll stick with what I have I think, Cheers, John.