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,e08ffaff681705c X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: access aliased obstacle Date: 1996/07/07 Message-ID: #1/1 X-Deja-AN: 164150704 references: <4rfig3$l5d@news1.delphi.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-07-07T00:00:00+00:00 List-Id: (Mailed and posted.) In article <4rfig3$l5d@news1.delphi.com>, wrote: >To pass a data structure to an OS routine I tried > > type elements(discriminant: enumeration_type:=normal_value) is record > case discriminant is > ... > end record; > for elements'size use 64; -- size does not vary > > type list_of_elements is array(1 .. 17) of aliased elements; > >but one of my Ada 95 compilers objected to aliasing unless I make a >subtype with a specific discriminant value, which defeats the purpose. >The LRM appears to me to agree with this compiler. The only obvious >possibility is unchecked_conversion. What is the 'right' way? The restriction you're talking about is in 3.6(11). It applies only to non-limited types. So, just make type Elements limited (i.e. change "is record" to "is limited record") and it will be OK. There is some discussion of the rule in the AARM starting at 3.6(11.a). - Bob