comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: access aliased obstacle
Date: 1996/07/07
Date: 1996-07-07T00:00:00+00:00	[thread overview]
Message-ID: <Du6J0A.AKp@world.std.com> (raw)
In-Reply-To: 4rfig3$l5d@news1.delphi.com


(Mailed and posted.)

In article <4rfig3$l5d@news1.delphi.com>,  <wtmoran@bix.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




  parent reply	other threads:[~1996-07-07  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-04  0:00 access aliased obstacle tmoran
1996-07-04  0:00 ` Robert Dewar
1996-07-06  0:00 ` Laurent Guerby
1996-07-07  0:00 ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-07-09  0:00 tmoran
1996-07-09  0:00 ` Laurent Guerby
1996-07-09  0:00   ` Robert Dewar
1996-07-09  0:00 ` Laurent Guerby
1996-07-09  0:00   ` Robert Dewar
1996-07-10  0:00     ` Robert A Duff
1996-07-09  0:00 ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox