comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Child vs nested package : efficiency matter
Date: Tue, 1 Jun 2010 12:44:46 -0700 (PDT)
Date: 2010-06-01T12:44:46-07:00	[thread overview]
Message-ID: <46fd21ad-347d-48c2-945b-72e3d1fcef79@t34g2000prd.googlegroups.com> (raw)
In-Reply-To: op.vdmx6by6xmjfy8@garhos

On Jun 1, 12:09 pm, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> Le Tue, 01 Jun 2010 20:35:02 +0200, Adam Beneschan <a...@irvine.com> a  
> écrit:> Something else that occurred to me: In the process of turning the
> > nested packages into child packages, were there any global variables
> > declared in the body of the parent package that you had to move to the
> > spec (probably the private part) so that they would be visible to the
> > child packages?
>
> No Adam, there was not. There were global variables, but just globals in  
> child packages, not in parent package.
>
> I've just found : pragma Inline is not automatically applied, it requires  
> the -gnatn option Brian talked about. I though this was automatically done  
> when the -O option is present (I rarely use inline, so I was not aware of  
> that).
>
> Anyway, I'm interested in your experience: what did occurred to you with  
> global variables ?

It was just a theory.  My thinking was that if you have a global
variable in a package *body* (and no subunits), a compiler can, in
theory, draw some conclusions about how the variable is used, since
there can be no uses of the variable except by subprograms in the
package body, and perhaps perform some optimizations based on that.
This doesn't work if the variable is in the spec (even in the private
part), since the compiler won't know what child packages might be
added later that have access to the variable.  Anyway, this was just a
theory, not really based on any experience.

                                 -- Adam



  reply	other threads:[~2010-06-01 19:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29 12:56 Child vs nested package : efficiency matter Yannick Duchêne (Hibou57)
2010-05-30  1:17 ` BrianG
2010-06-01 15:03 ` Adam Beneschan
2010-06-01 15:34   ` Yannick Duchêne (Hibou57)
2010-06-01 15:38     ` Adam Beneschan
2010-06-01 19:04     ` Simon Wright
2010-06-01 19:11       ` Yannick Duchêne (Hibou57)
2010-06-02 11:11         ` -gnatN breakage was: " Alex R. Mosteo
2010-06-02 14:39           ` Vadim Godunko
2010-06-02 16:45             ` Georg Bauhaus
2010-06-02 16:50               ` Yannick Duchêne (Hibou57)
2010-06-02 20:35               ` Vadim Godunko
2010-06-01 18:35 ` Adam Beneschan
2010-06-01 19:09   ` Yannick Duchêne (Hibou57)
2010-06-01 19:44     ` Adam Beneschan [this message]
2010-06-01 19:56       ` Yannick Duchêne (Hibou57)
2010-06-02  1:38     ` BrianG
replies disabled

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