From: Yannick Duchêne (Hibou57) on
Le Tue, 01 Jun 2010 21:44:46 +0200, Adam Beneschan <adam(a)irvine.com> a
écrit:
> 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.
While this could be, theoretically, also possible to do global
optimization (SmallEiffel and its successor SmartEiffel compiler did
this), compiling a program as a whole.

I understand what you mean, it's obvious.

--
There is even better than a pragma Assert: a SPARK --# check.
--# check C and WhoKnowWhat and YouKnowWho;
--# assert Ada;
-- i.e. forget about previous premises which leads to conclusion
-- and start with new conclusion as premise.
From: BrianG on
Yannick Duch�ne (Hibou57) wrote:
> 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).
>

Also note that there's a difference between -gnatn and -gnatN. The
latter is more thorough. It's been a while, but I think -gnatN is
required for multi-unit inlines.