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,29f8f005ed05b2f6,start X-Google-Attributes: gid103376,public From: WishList@2600.com (Technobabble) Subject: Thanks Tucker, It works !!! Date: 1998/09/19 Message-ID: #1/1 X-Deja-AN: 392846013 Organization: WannaBeACracker NNTP-Posting-Date: Sat, 19 Sep 1998 15:56:14 MDT Newsgroups: comp.lang.ada Date: 1998-09-19T00:00:00+00:00 List-Id: Greetings, The final code, which I compiled with GNAT, outputs the following: test_pkg test_pkg test_pkg test_pkg test_pkg Basically, I wanted to specify an unconstrained array in a spec for a user and then let the user constrain it. Then a procedure, also in the spec, could determine the size of the array, in this case 5, since the loop executed 5 times. But I had to do it with an access type per design requirements. Below is the final code, I still don't really understand the aliased, all, and access keywords working together to allow this sort of C-like pointer operation, but Ada95 does allow it. Anyone care to explain, I'd love to learn the reasons behind allowing pointer operations. Question: would this work in Ada83 not having these keywords??? Here is the final code: **** file test_pkg.ads **** package test_pkg is type xyz_array is array (integer range <>) of integer; -- this is it type xyz_array_pointer is access all xyz_array; type xyz_array_pointer_array is array (1..100) of xyz_array_pointer; type Object is record XYZ : xyz_array_pointer_array; abc : integer; end record; -- user can define this array externally, just here for demo xyz5_array : aliased xyz_array := (1..5 => 0); procedure my_range (This : in out Object); end test_pkg; **** file: my_main.adb **** with test_pkg; use test_pkg; procedure my_main is my_this : Object; begin my_range (my_this); end my_main; **** file: test_pkg.adb **** with Text_IO; use Text_IO; package body test_pkg is procedure my_range (This : in out Object) is begin -- next line can be externally done by user, here for demo This.XYZ(1) := xyz5_array'ACCESS; -- address of xyz5_array is assigned for I in This.XYZ(1)'RANGE loop put_line ("test_pkg"); end loop; end my_range; end test_pkg;