I'm having a simple file save/load functionality, but as it's a plugin, due to host API everything is being written into std::ostream in binary format, and read back again from std::istream.
i use
out.write((char *)&value,sizeof(type));
in.read((char *)&value,sizeof(type));
for reading and writing, where type is "unsigned int", "double", etc.
I was thinking about possible consequences of this, what happens when file is saved on one platform, and loaded on another (due to host limitations, this will be a 32/64 bit windows, 64bit linux and 64bit mac, only x86 cpus). if I do not use variable-size type, like size_t (which is different on 32bit and 64bit systems), can I be certain that "unsigned int" or "double" will stay same length? Is there any best-practices to handle this?