News for hackers. Stuff that matters.
Re:When Not to Serialize by faragon on Saturday August 11, 2018 @03:57AM (#17738821)
Example for C (for structures not using enums nor bitfields, because are compiler-dependant, and avoiding architecture-dependant types like e.g. size_t/ssize_t) :

if (islittleendian() && sizeof(mystruct) == REFSIZE_mystruct)

   memcpy(buffer, mystruct, sizeof(mystruct));
else

   conversion_mystruct(buffer, mystruct);
(so you can avoid slow serialization in most platforms)

There are no comments on this comment yet.