comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: Pointer to instance of indefinite array?
Date: Tue, 12 Aug 2014 20:29:04 -0600
Date: 2014-08-12T20:29:04-06:00	[thread overview]
Message-ID: <V3AGv.280259$wR1.68708@fx20.iad> (raw)
In-Reply-To: <892c6798-489d-400a-bb9a-7a14605c493f@googlegroups.com>

On 12-Aug-14 20:07, NiGHTS wrote:
> 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 Element_Array;
>
>      procedure Do_Something_With_Array (
>          In_Array : in Element_Array_Ptr
>      );
>
> end Test_Package;

What are you really trying to do? You can do everything you want in the 
example w/o touching access types:

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;
     procedure Do_Something_With_Array (In_Array : in Element_Array);
end Test_Package;

package body Test_Package is

     procedure Do_Something_With_Array (In_Array : in Element_Array) is
     begin
         for E of In_Array loop
             declare
                 Key	: String renames Positive'Image(E.ID_1);
                 Value	: String renames Positive'Image(E.ID_2);
             begin
                 Ada.Text_IO.Put_Line( "Key:"&Key &ASCII.HT& 
"Value:"&Value &'.' );
             end;
         end loop;
     end Do_Something_With_Array;

end Test_Package;

  parent reply	other threads:[~2014-08-13  2:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  2:07 Pointer to instance of indefinite array? NiGHTS
2014-08-13  2:09 ` Jeffrey Carter
2014-08-13  2:29 ` Shark8 [this message]
2014-08-13  3:06   ` NiGHTS
2014-08-13  4:28     ` Jeffrey Carter
2014-08-13 16:06       ` NiGHTS
2014-08-13 17:43         ` Jeffrey Carter
2014-08-13 17:58         ` Shark8
2014-08-13 18:36         ` Dmitry A. Kazakov
2014-08-13  4:31     ` Per Sandberg
2014-08-13  7:47       ` Georg Bauhaus
2014-08-13  8:05         ` Egil H H
2014-08-13 15:32         ` Adam Beneschan
2014-08-14  8:03           ` Georg Bauhaus
2014-08-13 18:17       ` Niklas Holsti
replies disabled

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