4 ms·
C is also relatively poor at providing “a way to define data structures which are really memory layouts”. Integer sizes (historically) and padding are implement
by Someone 4y ago
C is also relatively poor at providing “a way to define data structures which are really memory layouts”. Integer sizes (historically) and padding are implementation-defined, AFAIK bit fields are underspecified in that you cannot specify in what bits of a byte they end up.
- thesuperbigfrog 4y agoSo true. I wish that C had a more rich way to define struct layouts and low-level representations for integral types. I really like how Ada does it: https://en.wikibooks.org/wiki/Ada_Programming/Representation_clauses https://en.wikibooks.org/wiki/Ada_Programming/Representation... If you need to read or write specialized hardware registers, being able to define a data structure with a custom representation is very nice and can save significant time and effort.
- timbit42 4y agoI wish C had never been born.