From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81bce7ee9133fb42 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: GNAT Ada for DOS - Reading Integers Problem Date: 1996/02/21 Message-ID: #1/1 X-Deja-AN: 140573681 references: <4g2efj$d5d@susscsc1.rdg.ac.uk> <4gdivm$10f5@watnews1.watson.ibm.com> <4gfsuq$10f5@watnews1.watson.ibm.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-02-21T00:00:00+00:00 List-Id: Norman said Perhaps Robert is suggesting that the same effect could be achieved by writing type Half_Word is record Low : Byte; High : Byte; end record; for Half_Word'Bit_Order use Low_Order_First; for Half_Word use record Low at 0 range 0 .. 7; High at 0 range 8 .. 15; end record; type Byte_Swapped_Half_Word is new Half_Word; for Byte_Swapped_Half_Word'Bit_Order use High_Order_First; causing Byte_Swapped_Half_Word to inherit the literal text Low at 0 range 0 .. 7; High at 0 range 8 .. 15; from its parent's record representation clause, but to interpret that text big-endianly instead of little-endianly! This is certainly a creative interpretation, but I can't believe it is what the Founding Fathers intended. Absolutely, that is what Robert is suggesting, and I can't manage to read the intent of the RM any other way. When ytou derive, you inherit the rep clauses, and then you can override any or all of them, and the result is whatever you get from the mixture of inherited and overridden rep clauses. Now of course the above example is boring, since there are no fields overlapping storage boundaries (and is thus incidentally trivial to implement). The situation gets much more interesting with fields that overlap storage boundaries, because then the non-default order results in non-contiguous fields that are a real pain to implement.