Carlo Wood wrote:
On Tue, Aug 31, 2004 at 12:42:17AM +0000, Raj wrote:
what would a binary serialization class do?
To archive the class object data to be used at a later time in a file, and to not let the users simply read the contents.
A general "binary serialization class" would never know where builtin-variables begin and end (or what type they are) and therefore cannot swap bytes on Big-Endian machines.
You may be right, depending on the meaning of "general", but useful binary serializers do exist. You just need to decide how to represent the built-in types. For example, I've chosen that the external representation of a char is 8 bits, a short 16, int and long 32. This is perfectly portable, as long as the values of my variables do not exceed these limits.