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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1fd537a3da8a5021 X-Google-Attributes: gid103376,public From: Markku Kotiaho Subject: Re: Array access via pointer? Date: 2000/08/02 Message-ID: <3988448C.1D29354@lmco.com>#1/1 X-Deja-AN: 654644803 Content-Transfer-Encoding: 7bit References: <398721AD.CAEE3A51@home.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Lockheed Martin Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-08-02T00:00:00+00:00 List-Id: Michael Carman wrote: > ...: > > type Addr_Table is array (Natural range <>) of System.Address; > > Arr1 : Addr_Table (0 .. 100); > Arr2 : Addr_Table (0 .. 20); > > procedure Foo (Addr : in System.Address; > I : in Integer) is > begin > -- Do something with index I of the array at Addr > end Foo; You could just change Foo to something like: procedure Foo (Addr_Table_Entry : in System.Address); And call it with something like: Foo(Arr2(7)); Inside Foo, you can get at the array element which you sent with: Data := Addr_Table_Entry; > .... It > seems to me that there should be a way to do this without having to > fight against the language. So, what's the canonical way of doing > this in Ada? > > -mjc This may not be the "canonical way," but that would probably require rethinking your design entirely. MK