comp.lang.ada
 help / color / mirror / Atom feed
From: Markku Kotiaho <mark.kotiaho@lmco.com>
Subject: Re: Array access via pointer?
Date: 2000/08/02
Date: 2000-08-02T00:00:00+00:00	[thread overview]
Message-ID: <3988448C.1D29354@lmco.com> (raw)
In-Reply-To: 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;

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






      parent reply	other threads:[~2000-08-02  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-01  0:00 Array access via pointer? Michael Carman
2000-08-01  0:00 ` Ted Dennison
2000-08-02  0:00   ` Michael Carman
2000-08-03  0:00     ` Ken Garlington
2000-08-03  0:00       ` Robert A Duff
2000-08-03  0:00         ` Ken Garlington
2000-08-04  0:00           ` Robert I. Eachus
2000-08-04  0:00             ` Ken Garlington
2000-08-02  0:00 ` tmoran
2000-08-02  0:00   ` Michael Carman
2000-08-02  0:00     ` tmoran
2000-08-02  0:00 ` Markku Kotiaho [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox