comp.lang.ada
 help / color / mirror / Atom feed
From: "Ken Garlington" <Ken.Garlington@computer.org>
Subject: Re: Array access via pointer?
Date: 2000/08/03
Date: 2000-08-03T00:00:00+00:00	[thread overview]
Message-ID: <813i5.1869$SB4.159422@news.flash.net> (raw)
In-Reply-To: 3988269B.D1DB4EA5@home.com

"Michael Carman" <mjcarman@home.com> wrote in message
news:3988269B.D1DB4EA5@home.com...

[snip]

> My example was simplified to illustrate the problem I was having.
> Unfortunately, it oversimplified the situation a bit. I wasn't passing
> in a pointer to an array just for fun. I determine which array to
> process in a completely seperate part of the program.

[snip]

> [To further complicate things, I can't use 'Access -- I'm trying to keep
> my code Ada83 compatible -- I know how to work around it, it's just
> messier.]

Well, the Ada95 approach using 'Access is certainly much easier, but if you
have to stick with Ada83, IIRC we had some luck with the following:

---
with System, Unchecked_Conversion;
package Address_Fun is

  type Addr_Table_Values is array (Natural range <>) of System.Address;

 -- First, Last can be changed to Length if desired
  type Addr_Table (First, Last: Natural) is record
     Values: Addr_Table_Values(First .. Last);
  end record;

  type Addr_Table_Access is access Addr_Table;

  function To_Addr_Table_Access is new Unchecked_Conversion (System.Address,
Addr_Table_Access);

  procedure Foo (Table: in Addr_Table_Access; I: in Integer);

end Address_Fun;






  reply	other threads:[~2000-08-03  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 [this message]
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
replies disabled

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