Re:The Lost Art of Structure Packing (2018)
by samatman on Monday April 27, 2020 @05:44PM
(#23000473)
For all its somewhat fussy verbosity, Ada really impresses me every time this sort of thing comes up.
I keep hoping the Zig developer will do a deep dive on Ada and bring over more of this kind of precise control. A language where I have this kind of control over layout, but can still spell `end record;` as `}`, is ideal for some projects I have in mind.
Re:The Lost Art of Structure Packing (2018)
by SlowRobotAhead on Monday April 27, 2020 @02:02PM
(#22998257)
I use C for embedded. I do the “lost art” of structure packing all the time. I don’t want ada.
I’m not sure why “use a different language” is such a common reply to any language specific discussion.
Example:
Word : constant := 4; -- storage element is byte, 4 bytes per word
type State is (A,M,W,P); type Mode is (Fix, Dec, Exp, Signif);
type Byte_Mask is array (0..7) of Boolean; type State_Mask is array (State) of Boolean; type Mode_Mask is array (Mode) of Boolean;
type Program_Status_Word is record System_Mask : Byte_Mask;
More info: https://www.adaic.org/resources/add_content/standards/05aarm...