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,90884ee5a1c261b2 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Access type problem. Date: 1998/08/20 Message-ID: <6rhrhr$mhe@hacgate2.hac.com>#1/1 X-Deja-AN: 383079521 References: <35DC295E.D6A41D97@hiwaay.net> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Hughes Aircraft Company Newsgroups: comp.lang.ada Date: 1998-08-20T00:00:00+00:00 List-Id: Barry L. Dorough wrote in message <35DC295E.D6A41D97@hiwaay.net>... > I have some code where I have been carrying extra records around >because I don't know how to make the proper access type assignment. Any >help would be greatly appreciated. > Here is your example, modified so it will compile. The four changed lines are commented -- begin source code -- package Dorough is type Track_Data_Type is record Threat_Number : Integer; Threat_Id : Integer; X : Long_Float; Y : Long_Float; Z : Long_Float; end record; type Track_Data_Access is access all Track_Data_Type; -- changed -- type Track_Data_Array is array (Integer range <>) of aliased Track_Data_Type; -- changed type Track_Data_Array_Access is access Track_Data_Array; type Map_Type is record Int_Obj : Track_Data_Array_Access := new Track_Data_Array(1..10); -- In reality this is allocated dynamically based on current air picture Tgt_Obj : Track_Data_Array_Access:= new Track_Data_Array(1..10); -- In reality this is allocated dynamically based on current air picture end record; type Current_Pair_Type is record Interceptor : Track_Data_Access; Target : Track_Data_Access; end record; -- In reality there is a Current_Pair_Type allocated for each pairing saved in a linked list procedure Assign_Current_Pair( Map : in Map_Type; Int_Index : in Integer; Tgt_Index: in Integer; Pair : in out Current_Pair_Type); end Dorough; package body Dorough is procedure Assign_Current_Pair( Map : in Map_Type; Int_Index : in Integer; Tgt_Index: in Integer; Pair : in out Current_Pair_Type) is begin -- This is the crux of my problem. At present the Current_Pair_Type has -- Track_Data_Type instead of Track_Data_Access and my code looks like Pair.Interceptor := Map.Int_Obj (Int_Index) 'access; -- changed Pair.Target := Map.Tgt_Obj (Tgt_Index) 'access; -- changed -- I would have thought that this would work with the access types also, But -- I get type miss match errors. end Assign_Current_Pair; end Dorough; -- end source code -- David C. Hoos, Sr.