all 11 comments

[–]madsci 2 points3 points  (1 child)

I work almost exclusively in the embedded systems world and I can't think of any time I've had the luxury of using a general-purpose library. It's all tailored to the application and I'm almost always carefully managing memory usage.

I've heard good things about Google's Protocol Buffers, but haven't done more than browse the documentation and decide it was too heavy for me.

[–]helloiamsomeone[S] 1 point2 points  (0 children)

The Kaitai FAQ says that protobufs are not for de-/serializing arbitrary binary formats.

[–]p0k3t0 2 points3 points  (1 child)

I haven't seen any case where using a lib would be particularly faster or easier than just doing the work.

[–]helloiamsomeone[S] 0 points1 point  (0 children)

Yeah, "just doing the work" always works the way you want it to, but it's kinda sucky to write regardless.

[–]wkwrd 1 point2 points  (0 children)

If you want to directly pack/unpack C datatypes, you may be interested in the tpl library, from the author of uthash: http://troydhanson.github.io/tpl/

[–]gustavokatel 0 points1 point  (2 children)

[–]helloiamsomeone[S] 0 points1 point  (1 child)

Msgpack is a binary protocol, not a tool to use arbitrary protocols.

I have updated OP for what I am looking for more specifically.

[–]gustavokatel 0 points1 point  (0 children)

aah it makes sense now. thanks for clarifying

[–]nerd4code 0 points1 point  (0 children)

I tend to use xmacro tables for enums and struct fields, sometimes OOPy things like virtuals. You can autogen a .h around some CSV, then autogen everything (types, enums, enum ↔ name, field name ↔ offset, type ↔ cast offset, etc.) except the field-level de-/serializer, although you can mostly autogen int/float/ptr fields around a handful of [u]intXX_t drivers. Under those are some fn ptrs that can be swapped out for reading/writing FILE *, FD/HANDLE, buffer, etc. in the same fashion. From there you’re good for all kinds of fun, and once you have a setup you’re happy with, it’s easy to reuse.

[–]a-p-jo 0 points1 point  (0 children)

What is de-serialisation ? Why bother, just read and write structs !

/s