Skip to content
Discussion options

You must be logged in to vote

The short answer is that a flatbuffer schema allows enums, and if you use the bit_flags attribute on enums, they behave like bitfields by assigning values 1 << 0, 1 << 1, 1 << 2 etc. This is documented in the official FlatBuffers guide on writing a schema.

Bitfields in standard C are to my knowledge extremely rare (I don't even recall the syntax). Usefully enums are used, and preferably defined symbols because they work better as const expressions, e.g. in switch statements.

Thus, FlatCC makes no attempt to directly support bitfields.

FlatCC does support enums, and enums can be powers of two. These are not exactly like C enums.

Each enum value is defined as a numeric constant (again, this…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by o2cheretnyi
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants