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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!ottix-news.ottix.net!news.litech.org!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx28.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Function definitions References: <610b9d5b-a9a5-464d-9de3-b2f754f58cff@googlegroups.com> <5a8316fb-9b3d-405b-8199-edcaf18dcaa6@googlegroups.com> In-Reply-To: <5a8316fb-9b3d-405b-8199-edcaf18dcaa6@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Sun, 22 Jun 2014 07:00:02 UTC Organization: TeraNews.com Date: Sun, 22 Jun 2014 00:59:59 -0600 X-Received-Bytes: 2108 X-Received-Body-CRC: 1508242993 X-Original-Bytes: 2379 Xref: number.nntp.dca.giganews.com comp.lang.ada:187143 Date: 2014-06-22T00:59:59-06:00 List-Id: On 20-Jun-14 10:22, montgrimpulo wrote: > My modified question: > > 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; That won't work as-is because arrays within records cannot be unconstrained. You could make the package generic and use formal parameters though: Generic P, Q, R : in Natural:= 0; Package Search is type Individual is record X : x_array (0 .. P); Y : y_array (0 .. Q); Z : z_array (0 .. R); end record; function F (V : Individual) return Long_Float; function G (M : Natural; V : Individual) return Long_Float; End Search; --OR You could use discriminants: type Individual(P,Q,R : Positive:= 1) is record X : x_array (0 .. P); Y : y_array (0 .. Q); Z : z_array (0 .. R); end record;