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: 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!news.stack.nl!news.etla.org!poup.poupinou.org!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!s09-03.readnews.com!not-for-mail X-Trace: DXC=MM1d9fQAkZW_?jZLAGa<;^[3OhcoN[H0PX44`8^\]>7Z8DHB_I2k0TPAZ:KGYSY>WXLYC:N;>nMlR>_S52W7i:[Q@V3WNa\LBEUcQY User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Pointer to instance of indefinite array? References: <892c6798-489d-400a-bb9a-7a14605c493f@googlegroups.com> <58a951df-217b-48ee-bd0b-f9953f5b622b@googlegroups.com> In-Reply-To: <58a951df-217b-48ee-bd0b-f9953f5b622b@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <53eaea2e$0$32377$862e30e2@ngroups.net> NNTP-Posting-Host: a4d1aace.ngroups.net Xref: news.eternal-september.org comp.lang.ada:21706 Date: 2014-08-13T06:31:40+02:00 List-Id: Well, The compiler uses the most appropriate method of passing parameters (by value or by reference) depending on the kind of object, this usually means that composite types is passed by reference and scalars is passed by value. However your sample does compile with some small modifications: ------------------------------------------ package Test_Package is type Element is record ID_1 : Positive; ID_2 : Positive; end record; type Element_Array is array (Positive range <>) of Element; type Element_Array_Ptr is access all Element_Array; --> Use "all" to be able to reference objects allocated on staticly or stack. procedure Do_Something_With_Array (In_Array : in Element_Array_Ptr); end Test_Package; ----------------------------- with Test_Package; use Test_Package; procedure main is Test_Array : aliased Element_Array (1 .. 20); begin Do_Something_With_Array (In_Array => Test_Array'Unrestricted_Access); -- Use Unrestricted_Access attribute to disable -- accessibility and aliased view checks end main; ---------------------------- /Per On 13.08.2014 05:06, NiGHTS wrote: > On Tuesday, August 12, 2014 10:29:04 PM UTC-4, Shark8 wrote: >> On 12-Aug-14 20:07, NiGHTS wrote: >> What are you really trying to do? You can do everything you want in the >> example w/o touching access types: > > On Tuesday, August 12, 2014 10:09:37 PM UTC-4, Jeffrey Carter wrote: >> Think in Ada and get rid of the access type. > > Hmm. You're right. It worked! Compiler must be changing it internally to a pointer though since it would be far too inefficient to copy the entire array. >