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, MSGID_RANDY 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: Ted Dennison Subject: Re: Array access via pointer? Date: 2000/08/01 Message-ID: <8m7hn1$i4r$1@nnrp1.deja.com>#1/1 X-Deja-AN: 653370903 References: <398721AD.CAEE3A51@home.com> X-Http-Proxy: 1.0 x66.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Aug 01 22:07:32 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-08-01T00:00:00+00:00 List-Id: In article <398721AD.CAEE3A51@home.com>, 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; > fight against the language. So, what's the canonical way of doing > this in Ada? That would be: procedure Foo (Addr : in out Addr_Table; I : in Integer) is begin -- Do something with index I of the array at Addr end Foo; It may be much more constructive for you to tell us why you feel you need to use addresses and pointers. In Ada you almost *never* have to use addresses, and rarely have to use pointers. Unless you have an actual dynamic or linked data structure, or are interfacing to some external C or OS call, you are probably doing something wrong when you write code with addresses and/or pointers in it. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.