comp.lang.ada
 help / color / mirror / Atom feed
From: "Adam Beneschan" <adam@irvine.com>
Subject: Re: GNAT-2005
Date: 10 Nov 2006 08:56:42 -0800
Date: 2006-11-10T08:56:42-08:00	[thread overview]
Message-ID: <1163177802.563194.164270@h54g2000cwb.googlegroups.com> (raw)
In-Reply-To: uveln7798.fsf@stephe-leake.org

Stephen Leake wrote:
> "rashmi" <rashmi.thoras@gmail.com> writes:
>
> > I have a problem with trying to understand GNAT's working for the
> > following:
> ><snip spec>
>
> > 3. I find that if I delete the first few lines that give specs for
> > FUNC_ScBAVCK or FUNC_ScBAFCk, for which records are parameters, and
> > then compile the package's body (.adb), GNAT does not report that
> > functions are undefined. On the other hand, if I delete a specs line
> > such as that for FUNC_BAVCPRd for which scalars are parameters, GNAT
> > immediately reports "function FUNC_BAVCPRd undefined" when I compile
> > the body.
>
> Without seeing the body, it's impossible to say.
>
> Most likely the bodies of the "scalar functions" are present in the
> package body _before_ the places they are called.

That seems most likely to me, too.

Things have to be declared before they can be used (with few
exceptions).  When you call one of these functions in the body, the
compiler has to have seen it previously---either in the spec, or
earlier in the body.  If you remove the declaration of a function from
the spec, it's still OK to call it IF it is defined in the body before
it's used---but not if it's defined in the body after it's used.  So
that's probably why you're getting errors in some cases but not others.

                             -- Adam




  reply	other threads:[~2006-11-10 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10  6:51 GNAT-2005 rashmi
2006-11-10 10:52 ` GNAT-2005 Georg Bauhaus
2006-11-10 13:37 ` GNAT-2005 Stephen Leake
2006-11-10 16:56   ` Adam Beneschan [this message]
2006-11-12 18:55     ` GNAT-2005 Martin Krischik
2006-11-13 20:35       ` GNAT-2005 Simon Wright
2006-11-13 22:12         ` GNAT-2005 Jean-Pierre Rosen
2006-11-13 22:25         ` GNAT-2005 Georg Bauhaus
2006-11-13 23:41         ` GNAT-2005 Björn Persson
2006-11-14  7:16         ` GNAT-2005 Pascal Obry
2006-11-15 22:57           ` GNAT-2005 Simon Wright
2006-11-10 15:13 ` GNAT-2005 Wilhelm Spickermann
replies disabled

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