Proper serialization can be used to send data to arbitrary systems that may not work in the same architecture as the original host.
Even an object consisting only of native types can be an unpleasant sharing of two systems due to the additional complement that can exist between and after members, by the way. Sharing raw dumps of object memory between programs compiled for the same architecture but with different versions of the compiler can also be a big problem. There is no guarantee that the type of the variable T is actually stored in memory.
If you do not work with pointers (links are included), and the data is intended to be read by the same binary code from which it is flushed, it is usually safe only to unload the raw structure to disk, but when sending data to another host .. drum roll serialization is the way to go.
I heard that the developers talked about ntohl
/ htonl
/ ntohl
/ ntohs
as methods for serializing / deserializing integers, and when you think about it, saying that it is not so far from the truth.
The word "serialization" is often used to describe this "complex method of storing data in a general way", but again; your first programming assignment, in which you were asked to save information about dogs to a file (hopefully * ), somehow used serialization.
* "hope", which means that you did not unload the original memory representation of your Dog
object to disk
Filip Roséen - refp
source share