is there a way to deterministically create interoperable code?
This is kind of a simple example still, because I’d also like to be able to interoperate with code that’s written like this where there are a bunch of uint8 boolx:1 (let’s say 5 of them), then some other fields, and then a few more uint8 boolx:1 again. How can I write interop bindings for them with Odin?
I believe C bit fields are not standardised but I also believe most of the compilers implement them reasonably like Odin does. That being said this should be equivalent:
The way they work in C code, yes. The way they’re laid out in memory is entirely implementation-defined, though–and that’s what’s relevant for binding it.
But you will see a warning when you do this as it suggests you should use a bit_set instead if all of the flags are 1-bit in size, because bit_set is for FLAGS specifically.