comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: We should introduce aliased types
Date: Fri, 1 Aug 2014 14:49:13 -0500
Date: 2014-08-01T14:49:13-05:00	[thread overview]
Message-ID: <lrgqvq$4oi$1@loke.gir.dk> (raw)
In-Reply-To: lrgqnq$4i3$1@loke.gir.dk

"Randy Brukardt" <randy@rrsoftware.com> wrote in message 
news:lrgqnq$4i3$1@loke.gir.dk...
> "Victor Porton" <porton@narod.ru> wrote in message
...
> And you can't directly declare a component as
>    Ptr : access T := T'Access;
> because of accessibility; the problem isn't whether T is aliased or not. 
> "access T" is a library-level type, while T'Access might refer to a local 
> object, so the access type could outlive the object (in particular, this 
> component could be copied into an object of another library-level type), 
> and that's not allowed.

Actually, you can do that so long as you use Unchecked_Access:

      type T is limited record
          Ptr : access T := T'Unchecked_Access;
      end record;

                                 Randy.


  reply	other threads:[~2014-08-01 19:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 18:54 We should introduce aliased types Victor Porton
2014-08-01 18:56 ` Victor Porton
2014-08-01 19:16 ` Victor Porton
2014-08-01 19:47   ` Randy Brukardt
2014-08-01 19:57     ` Victor Porton
2014-08-01 19:44 ` Randy Brukardt
2014-08-01 19:49   ` Randy Brukardt [this message]
2014-08-01 20:39 ` sbelmont700
replies disabled

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