Hacker News new | past | comments | ask | show | jobs | submit login

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)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: