comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: GNAT-2005
Date: Sun, 12 Nov 2006 19:55:55 +0100
Date: 2006-11-12T19:55:55+01:00	[thread overview]
Message-ID: <1198984.tjZffbbRqh@linux1.krischik.com> (raw)
In-Reply-To: 1163177802.563194.164270@h54g2000cwb.googlegroups.com

Adam Beneschan wrote:

> 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.

Indeed, gnat with full warnings will actually create a warning if the
function only has a body but is not defined - either in the spec or earlier
in the body. This goes well with the gnat style checks which demand bodies
to be sorted.

Martin
-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



  reply	other threads:[~2006-11-12 18:55 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   ` GNAT-2005 Adam Beneschan
2006-11-12 18:55     ` Martin Krischik [this message]
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