comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: Elaboration of nested generic package.
Date: Thu, 10 Jul 2003 15:39:48 GMT
Date: 2003-07-10T15:39:48+00:00	[thread overview]
Message-ID: <3F0D88A3.2040805@attbi.com> (raw)
In-Reply-To: 1ec946d1.0307100612.20a3d000@posting.google.com

Matthew Heaney wrote:

> I would still like a definitive answer, though.  In order to make a
> library-level package instantiation, do I need to use Elaborate_All on
> the generic unit? (As in the example above.)

Hmmm.  A marginal case, but I would go ahead and do it.  You are using 
the generic declaration before the main program starts, but may or may 
not need Elaborate_All instead of Elaborate.  Use of Elaborate is 
deprecated.  There are cases where Elaborate will work but Elaborate_All 
can't.  However, it is unlikely that you will run into one.

> Also: do the categorization pragmas in a generic unit make any
> difference?  In other words, you still need to say Elaborate_All,
> irrespective of what the generic unit says about categorization --
> correct?

Technically, the right answer is that you don't need Elaborate or 
Elaborate_All for packages without bodies.  This is very different from 
what the categorization pragmas do.

Most compilers today try to elaborate the body immediately after the 
package specification whenever possible.  So all these discussions of 
pragma Elaborate_All really deal with the cases where that is not 
possible.  Let me give an example:

package Foo is...end Foo;

with Foo;
package Bar is...end Bar;

with Bar;
package body Foo is...end Foo;

package body Bar is...end Bar;

Once you have this sort of loop, elaboration can become an issue.  In 
this case there is nothing in the language rules that determines whether 
the body of Foo will be elaborated before the body of Bar (or 
vice-versa) absent pragmas.  Most of the time it won't matter.  But if 
you know that elaboration of the body of Foo will call a subprogram in 
Bar, you should provide the pragma.  Or elaboration of the body of Bar 
could call a subprogram in Foo.  If both occur, or could occur, that is 
when you have elaboration problems.
-- 

                                                        Robert I. Eachus

�In an ally, considerations of house, clan, planet, race are 
insignificant beside two prime questions, which are: 1. Can he shoot? 2. 
Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and 
Steve Miller.




  reply	other threads:[~2003-07-10 15:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02  4:13 Elaboration of nested generic package christoph.grein
2003-07-08  3:05 ` Don Westermeyer
2003-07-08 17:46   ` Matthew Heaney
2003-07-10  1:10     ` Don Westermeyer
2003-07-10  1:35       ` Robert I. Eachus
2003-07-10  4:51         ` Robert I. Eachus
2003-07-10  6:58           ` Jean-Pierre Rosen
2003-07-10 15:08             ` Robert I. Eachus
2003-07-11 21:26             ` Robert A Duff
2003-07-10 14:12         ` Matthew Heaney
2003-07-10 15:39           ` Robert I. Eachus [this message]
2003-07-11 21:41           ` Robert A Duff
2003-07-14 18:35             ` Matthew Heaney
2003-07-15 17:19               ` Randy Brukardt
2003-07-16 15:24                 ` Matthew Heaney
2003-07-17  2:08                   ` Randy Brukardt
2003-07-17 15:54                     ` Richard Riehle
2003-07-10 15:03         ` Don Westermeyer
2003-07-10 15:45       ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-07-09  5:21 christoph.grein
2003-07-01 20:14 Don Westermeyer
replies disabled

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