News for hackers. Stuff that matters.
Re:Ask HN: When does it make sense to roll your own X? by CoolGuySteve on Sunday July 14, 2019 @11:17AM (#20433860)
> .. 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.

There are no comments on this comment yet.