2 ms·
Quite true. C bitpacking is lousy. The best "bitpacking" I have ever dealt with is the "Erlang Bit Syntax". I really wish more languages would adopt it. See
by bsder 5y ago
Quite true. C bitpacking is lousy.
The best "bitpacking" I have ever dealt with is the "Erlang Bit Syntax". I really wish more languages would adopt it.
See: https://www.erlang.org/doc/programming_examples/bit_syntax.html https://www.erlang.org/doc/programming_examples/bit_syntax.h...
- deaddodo 5y agoI've always thought Ada's syntax was the clearest as to what's being defined and accessed[1]. That being said, it's Ada...so good luck finding a use case. 1 - https://stackoverflow.com/questions/58493193/ada-how-to-explicitly-pack-a-bit-field-record-type https://stackoverflow.com/questions/58493193/ada-how-to-expl...
- pyjarrett 5y agoAda is often used in microcontrollers where this is very common. I write command line tools in Ada, and some other things, I've found this bit layout very useful when reading/writing binary file formats, or when binding to C and matching C struct layout.
- deaddodo 5y agoFair. I’m quite fond of Ada because or my Pascal/Wirth early origins, but I personally haven’t ever needed to use it. Glad to hear it’s found some uses outside of the US military.