Cross-platform and language (de)serialization

后端 未结 7 1109
一个人的身影
一个人的身影 2021-02-07 22:13

I\'m looking for a way to serialize a bunch of C++ structs in the most convenient way so that the serialization is portable across C++ and Java (at a minimum) and across 32bit/6

7条回答
  •  情话喂你
    2021-02-07 22:29

    If I want to go really really cross language, I normally would suggest JSON, as the ease of javascript support and an abundance of libraries, as well as being human readable and modifiable (I prefer it to XML as I find it smaller in terms of chars, faster, and more readable). It's not the most efficient in terms of space, however, and a more machine readable format like protocol buffers or thrift would have advantages there (thrift can be made from an IDL, but it is also made for encoding services, so it could be heavier than you want).

提交回复
热议问题