FlatBuffers Language interoperability?

37 views
Skip to first unread message

Ethan Zhou

unread,
Aug 2, 2017, 5:01:49 PM8/2/17
to FlatBuffers
Do all the different language implementations of Flatbuffers generate binaries that can be read by other FlatBuffers implementations? For example, if I encode some data using the C++ implementation, and send the schema + binary data over to a C implementation, might there be any potential issues?

I'm asking because I noticed that the FlatBuffers Internals guide says:

Note that this not the only possible encoding, since the writer has some flexibility in which of the children of root object to write first (though in this case there's only one string), and what order to write the fields in. Different orders may also cause different alignments to happen.

which suggests that different implementations could create different binaries for equivalent data.

Wouter van Oortmerssen

unread,
Aug 3, 2017, 11:18:31 AM8/3/17
to Ethan Zhou, FlatBuffers
Yes, they are all compatible with eachother. The order in which fields are written does not affect the reader, beyond possible cache optimisation etc. The data will still look exactly the same.

Think of the different orders a tree can be stored in C++ in memory, depending on the memory manager implementation. The reader never notices the difference. FlatBuffers is similar.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages