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 X-Received: by 10.52.114.196 with SMTP id ji4mr1004919vdb.1.1407895626075; Tue, 12 Aug 2014 19:07:06 -0700 (PDT) X-Received: by 10.182.221.163 with SMTP id qf3mr10971obc.0.1407895625871; Tue, 12 Aug 2014 19:07:05 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!j15no6694500qaq.0!news-out.google.com!px9ni588igc.0!nntp.google.com!h18no19232384igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Aug 2014 19:07:05 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=73.179.102.101; posting-account=wEPvUgoAAABrLeiz_LRhQ3jeEhyfWVMH NNTP-Posting-Host: 73.179.102.101 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <892c6798-489d-400a-bb9a-7a14605c493f@googlegroups.com> Subject: Pointer to instance of indefinite array? From: NiGHTS Injection-Date: Wed, 13 Aug 2014 02:07:05 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2507 X-Received-Body-CRC: 2626850991 Xref: news.eternal-september.org comp.lang.ada:21701 Date: 2014-08-12T19:07:05-07:00 List-Id: Suppose I have a package like this... package Test_Package is type Element is=20 record ID_1 : Positive; ID_2 : Positive; end record; type Element_Array is array (Positive range <>) of Element; type Element_Array_Ptr is access Element_Array; procedure Do_Something_With_Array ( In_Array : in Element_Array_Ptr ); end Test_Package; In this situation I have an array of "Element" records with an unknown numb= er of elements. The number of elements are to be defined by the user of thi= s package and passed as a pointer to the procedure "Do_Something_With_Array= ". So a simple implementation would be something like this... with Test_Package; use Test_Package; procedure main is=20 Test_Array : aliased Element_Array (1 .. 20); begin -- Initialize the array, then call this function... Do_Something_With_Array (In_Array =3D> Test_Array'Access); end main; So this does not compile and with countless errors no matter what configura= tion I try. I have a feeling my approach is fundamentally wrong. Essentiall= y I am trying to pass a constrained array to a package accepting an array o= f any length, both of the same element type. I would parse the contents of = this array using "for in" or 'First -> 'Last or 'Range.=20 What is the best way to achieve this goal without using new / free?