comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to get around "access type must not be outside generic unit"
Date: Mon, 18 Dec 2006 14:57:15 -0600
Date: 2006-12-18T14:57:15-06:00	[thread overview]
Message-ID: <HfGdnbcVh-XvnRrYnZ2dnUVZ_sudnZ2d@megapath.net> (raw)
In-Reply-To: 4586FAC4.2000003@snafu.de

"Michael Erdmann" <michael.erdmann@snafu.de> wrote in message
news:4586FAC4.2000003@snafu.de...
> Brian May wrote:
...
> > I would have thought since Install was defined within the generic
> > unit, Install'Access would be OK.
> >
> > Or does Install'Access imply a temporary local variable?
> >
> > Put another way, how can you create a dangling pointer with
> > Install'Access but not Install_Access?
>
> This is exactly what came into my mind when i was looking
> at the offending code.

Jean-Pierre explains it well. If you instantiate the generic inside a
procedure, the access value could last longer than the procedure it points
at. That's a no-no. Since generic bodies use "assume-the-worst" legality
rules, it is illegal because it *might* happen.

It should be noted that this rule dates back to Ada 95 (although it was
poorly described in Ada 95). AI95-229 explains the issues, find it on
www.ada-auth.org.

               Randy.





  reply	other threads:[~2006-12-18 20:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-17 10:07 How to get around "access type must not be outside generic unit" Michael Erdmann
2006-12-17 12:45 ` Pascal Obry
2006-12-17 14:28   ` Michael Erdmann
2006-12-17 15:53     ` Pascal Obry
2006-12-17 20:49     ` Robert A Duff
2006-12-18  3:35   ` Brian May
2006-12-18  7:49     ` Jean-Pierre Rosen
2006-12-18 23:15       ` Brian May
2006-12-19  1:48         ` Randy Brukardt
2006-12-19  7:41         ` Jean-Pierre Rosen
2006-12-18 20:32     ` Michael Erdmann
2006-12-18 20:57       ` Randy Brukardt [this message]
2007-01-23 18:18 ` [Revisited] How to get around "access type must not be outside generic unit" (was: How to get around "access type must not be outside generic unit") Dmitry A. Kazakov
2007-01-24  0:57   ` Randy Brukardt
2007-01-24 11:42     ` [Revisited] How to get around "access type must not be outside generic unit" Dmitry A. Kazakov
2007-01-24 11:58       ` Ludovic Brenta
2007-01-24 13:46         ` Dmitry A. Kazakov
2007-01-24 20:50       ` Randy Brukardt
2007-01-25 11:07         ` Dmitry A. Kazakov
replies disabled

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