comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Access to subprogram
Date: 07 May 2002 12:16:22 -0400
Date: 2002-05-07T16:22:59+00:00	[thread overview]
Message-ID: <uy9ew53xl.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: mailman.1020776522.17239.comp.lang.ada@ada.eu.org

"David C. Hoos" <david.c.hoos.sr@ada95.com> writes:

> From: "Sebastian" <sebastian.madunic@avionics.saab.se>
> > What is the meaning of this
> > " subprogram must not be deeper than access type"
> It means exactly what it says.  You're trying to take the access
> value of a subprogram that is nested more deeply than is the
> place where the access type is declared.
> 
> To remedy this, you need to do one of two things, viz.:
> 
>    1.  Declare the subprogram at library level -- i.e., not in
>         a package or nested within another subprogram
> 
>    2.  Use 'Unrestricted_Access instead of 'Access, if you're
>         using GNAT, and if your are certain that the lifetime of
>         the subprogram is at least as long as the lifetime of the
>         access type.

Rule 2 is actually too restrictive. You can use Unrestricted_Access if
you are sure that the lifetime of the program is at least as long as
that of all copies of the access value. The compiler assumes copies of
the access value can last as long as the access type, but you don't
have to.

-- 
-- Stephe



  reply	other threads:[~2002-05-07 16:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07 12:47 Access to subprogram Sebastian
2002-05-07 13:01 ` David C. Hoos
2002-05-07 16:16   ` Stephen Leake [this message]
2002-05-08  6:03   ` Sebastian
  -- strict thread matches above, loose matches on Subject: below --
2002-05-07 12:56 Grein, Christoph
replies disabled

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