comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal MALAISE <malaise@magic.fr>
Subject: Re: using 'address to make indrect calls
Date: 1999/06/30
Date: 1999-06-30T17:57:39+00:00	[thread overview]
Message-ID: <377A5A93.AB271D47@magic.fr> (raw)
In-Reply-To: 3779194C.45EA@b.com

"Raymond C. Rawa" wrote:
>    1:generic
>    2:package G_PKG is
>    3:end G_PKG;

>   14:with G_PKG;
>   15:procedure test is
>   16:   package g is new G_PKG;
> A --------------^
> A:warning: using this address to make an indirect call may produce
> unpredictable results if the subprogram makes uplevel references.
> A:warning:      at line: 10 column: 14 within generic g_pkg in file:
> /MV22/system/rawa/jass_3.2/jass_stubs.ss/dev.wrk/test/test.a

The instanciation in make within a procedure/function.
The validity of the instanciated objects ends when the procedure ends.
Suppose G_PKG declares objects (variables, procedures) and test stores
the address of such object in a "global", remanent variable (in a
package spec):
other_package.g_object_address := g.object'address
the using other_package.g_object_address after the end of g leeds to
unpredicable result.
The compiler does not know that test is your main procedure. Neither do
I,
but I suppose, and in this case (test is the "main") there is no danger.

If you want to get rid of the warning:
with G_PKG;
package g is new G_PKG;

with g;
procedure test is


Then the instanciation is more "static".

-- 
Pascal MALAISE
(priv) mailto:malaise@magic.fr
(prof) mailto:malaise@fr.airsysatm.thomson-csf.com




  reply	other threads:[~1999-06-30  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-29  0:00 using 'address to make indrect calls Raymond C. Rawa
1999-06-30  0:00 ` Pascal MALAISE [this message]
1999-06-30  0:00   ` Robert Dewar
1999-07-01  0:00   ` Raymond C. Rawa
1999-07-01  0:00 ` Robert A Duff
1999-07-01  0:00   ` Dale Stanbrough
1999-07-02  0:00     ` Robert A Duff
replies disabled

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