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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Function definitions Date: Fri, 20 Jun 2014 16:43:22 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <610b9d5b-a9a5-464d-9de3-b2f754f58cff@googlegroups.com> <5a8316fb-9b3d-405b-8199-edcaf18dcaa6@googlegroups.com> Injection-Date: Fri, 20 Jun 2014 16:43:22 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e458ff8b81bc0c159989eb0e36c6e372"; logging-data="9876"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GgetTe1SNtV74Ok7bapo5P2A1jPBJWyw=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:6n+omPljOKNdVIITnK7dANprzEU= X-Original-Bytes: 2836 Xref: number.nntp.dca.giganews.com comp.lang.ada:187095 Date: 2014-06-20T16:43:22+00:00 List-Id: On 2014-06-20, montgrimpulo wrote: > > Hi, > What would be an answer to the following question: > There are three files : search.ads, search.adb, main_search.adb. > > In search.ads two functions are defined: function F and function G, as > > function F (V : Individual) return Long_Float; and > > function G(M : Natural; V : Individual) return Long_Float; > > Individual is defined as a Record containing several arrays > with a size determined by variables, eg . > > type Individual is record > X : x_array (0 .. P); > Y : y_array (0 .. Q); > Z : z_array (0 .. R); > end record; > > In search.adb there are several procedures using the functions F and G > defined in search.ads. > > The general search procedure g_search (P, Q, R) (defined in search.adb) is > called in main_search.adb. > > As I want to define the internal statements of F and G, and other > paramenters, (eg. P,Q,R), only in file main_search.adb, I don't know how to > define F and G in search.ads / search.adb, as their body is claimed to be > missing in search.adb. It sounds like you have the spec for F and G in search.ads (which is probably correct) but instead of placing the body in search.adb, you want to place it in an unrelated main_search.adb. If so, that's wrong; the body belongs in search.adb. You then "with", in main_search.adb, the "search" package and reference it from main_search.adb. If you have attempted to place the body for F and G in search.adb and failed, we need to see example code _and_ the _exact_ error messages. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world