3 ms·
> .. as long as you never change endianness, structure packing, word alignment requirements, and always use types with explicit sizes. #pragma pack(1) and byte
by CoolGuySteve 7y ago
> .. as long as you never change endianness, structure packing, word alignment requirements, and always use types with explicit sizes.
#pragma pack(1) and byteswapping solve all this and neither are more work than specifying some intermediate format and calling some external tool in your build system. In C++ you can make types that swap automatically if required.
> And you have to keep the data in the structure itself, so as soon as you hit a pointer you need to write explicit serialisation.
I have yet to see a serialization format that does this well and quickly. Just make a new message type for it that follows the first.