4 ms·
To be fair, the problem with C bitfields that causes them to be forbidden in many coding standards is that don't offer "precise control over data layout". They
by jandrewrogers 5y ago
To be fair, the problem with C bitfields that causes them to be forbidden in many coding standards is that don't offer "precise control over data layout". They are underspecified, so a lot of C/C++ code bases construct bitfields explicitly and manually (and these have other advantages anyway). And of course you can do the same in Rust.
Rust has limitations as a systems language but this isn't one of them.
- ajxs 5y agoWhat do you mean this isn't one of Rust's limitations? It's a common, well-understood feature of systems languages, which Rust doesn't have. Look for yourself on Rosetta Code[0]. There are many languages that feature a way to define a structure with individual bit fields: Basic, Fortran, Ada, etc. [0]https://rosettacode.org/wiki/Memory_layout_of_a_data_structure https://rosettacode.org/wiki/Memory_layout_of_a_data_structu...