3 ms·
A few years ago, I ran into some situations where packed structs would be useful. I ended up writing a lot of little test programs to verify struct sizes based
by khedoros 10y ago
A few years ago, I ran into some situations where packed structs would be useful. I ended up writing a lot of little test programs to verify struct sizes based on different element orders, packing pragmas, etc. It was certainly illuminating, but it would've been helpful having a write-up like this to work from.
It got even more complicated when I threw unions into the mix. Knowing how the data is stored at the bit level becomes important in some of those cases.