From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d89b829a7e0c6c44 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-ID: <1198984.tjZffbbRqh@linux1.krischik.com> From: Martin Krischik Subject: Re: GNAT-2005 Newsgroups: comp.lang.ada Date: Sun, 12 Nov 2006 19:55:55 +0100 References: <1163141479.498169.10580@b28g2000cwb.googlegroups.com> <1163177802.563194.164270@h54g2000cwb.googlegroups.com> User-Agent: KNode/0.10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 80.218.118.14 (80.218.118.14) NNTP-Posting-Date: Sun, 12 Nov 2006 20:45:12 +0100 X-Trace: b7e80455779c8f57fd3ab25268 Xref: g2news2.google.com comp.lang.ada:7420 Date: 2006-11-12T19:55:55+01:00 List-Id: Adam Beneschan wrote: > Stephen Leake wrote: >> "rashmi" writes: >> >> > I have a problem with trying to understand GNAT's working for the >> > following: >> > >> >> > 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