Live data from Hacker News

Show HN: Hexi – Modern header-only network binary serialisation for C++

github.com

41–49 of 49 posts

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#41
This looks very cool. Based on the examples, you might like XDR.

It’s far better than the other binary serialization protocols I’ve looked at / implemented. NFSv3 uses it, and it is compatible with a lot of the tricks you play, like in-place endian translation, branch avoidance, zero allocation use cases, etc:

https://www.rfc-editor.org/rfc/rfc1014

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#43
incidentally, the block allocator implementation fails to properly account for alignment requirements:

since the underlying storage is std::array, it's alignment may be less that the required alignment of the requested type and that of the pointers being stored in the free list.

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#45
post #41

This looks very cool. Based on the examples, you might like XDR. It’s far better than the other binary serialization protocols I’ve looked at / implemented. NFSv3 uses it, and it is compatible with a lot of the tricks you play, like in-place endian translation, branch avoidance, zero allocation use cases, etc: https://www.rfc-editor.org/rfc/rfc1014

Thanks for the interesting link. :)

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#46
post #35

These days, whenever i read "headet only" i immediately get scared about compile times. Does using this library make compilation expensive in the way that eg protobuf or nlohmann_json do?

I'm biased but in my experience, no, not at all.

I don't use the amalgamated version, though (that only exists for this standalone version) and the library overall is significantly smaller than either of those and doesn't drag in nearly as many standard library headers.

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#48

Why .h for a CPP library and not .hpp? Threw me off as I usually expect .h to be associated with C files, opening it I find modern C++.

.h is the more common convention even in the C++ world.

Cool!! Did not know :)

Re: Show HN: Hexi – Modern header-only network binary serialisation for C++

#49
post #10

Your lib requires manually creating both a serializing and deserializing function. If the functions are out of sync, bad things happen. Consider copying Cereal, which solves this problem by requiring you to create a single templated function ( https://uscilab.github.io/cereal/ )

Thanks again for this comment. Consider Cereal copied, now only a single function is required.
Post reply on HN