From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Accessibility Levels and Library-Level Units
Date: Tue, 24 Sep 2013 12:31:08 -0700
Date: 2013-09-24T12:31:08-07:00 [thread overview]
Message-ID: <l1sp9s$jnc$2@dont-email.me> (raw)
In-Reply-To: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com>
On 09/24/2013 11:36 AM, Eryndlia Mavourneen wrote:
>
> 1) All the units -- packages and procedure -- are at library level.
> 2) The procedure is statically defined and is not going to be
> deallocated until the program exits.
>
> This is very frustrating and would seem to preclude the definition of a
> procedural access type in a separate definitions package. The Implementation
> package (defining procedure Sub but not shown) compiles nicely, btw.
>
> Is this a problem with Gnat? If not, how can I do what I want to do? The
> attribute Unchecked_Access is not available for subprogram access types.
Your main-program procedure, while declared at the library level, is not
necessarily at library level. This is because it is a subprogram, and its
accessibility level is determined by where and when it is called. Although you
know that it is only called by the environment task once, the compiler doesn't
know that, and the language provides no way to tell the compiler that, probably
because checking it is painful. The procedure could call itself recursively, or
something else could with it and call it. In either case, the accessibility
level of the procedure nested within it will not be library level.
There are 2 ways to do what you want: declare the subprogram (whose access value
will be assigned to the access object) in a library-level package, or use an
anonymous access-to-subprogram parameter rather than a named
access-to-subprogram type.
--
Jeff Carter
"He didn't get that nose from playing ping-pong."
Never Give a Sucker an Even Break
110
next prev parent reply other threads:[~2013-09-24 19:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 18:36 Accessibility Levels and Library-Level Units Eryndlia Mavourneen
2013-09-24 18:54 ` Eryndlia Mavourneen
2013-09-24 19:23 ` Adam Beneschan
2013-09-24 19:06 ` mockturtle
2013-09-25 7:46 ` Dmitry A. Kazakov
2013-09-24 19:13 ` mockturtle
2013-09-24 19:23 ` Eryndlia Mavourneen
2013-09-24 19:27 ` Adam Beneschan
2013-09-24 20:02 ` J-P. Rosen
2013-09-24 20:17 ` Eryndlia Mavourneen
2013-09-24 20:32 ` Adam Beneschan
2013-09-24 19:31 ` Jeffrey Carter [this message]
2013-09-24 19:43 ` Eryndlia Mavourneen
2013-09-24 19:59 ` Adam Beneschan
2013-09-24 20:50 ` Robert A Duff
2013-09-25 14:40 ` Eryndlia Mavourneen
2013-09-25 21:34 ` Robert A Duff
2013-09-26 12:46 ` Eryndlia Mavourneen
2013-09-29 21:36 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox