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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,bfad7b01b410c9fb X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Pointer types (I mean access types) Reply-To: anon@anon.org (anon) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Sat, 11 Jul 2009 19:41:08 GMT NNTP-Posting-Host: 12.65.162.18 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1247341268 12.65.162.18 (Sat, 11 Jul 2009 19:41:08 GMT) NNTP-Posting-Date: Sat, 11 Jul 2009 19:41:08 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:7001 Date: 2009-07-11T19:41:08+00:00 List-Id: Most books on both languages have the link link example. just find one for each lang and compare. Execpt for the deallocation routine, your list look correct. In Ada, for deallocation, there is a package "Ada.Unchecked_Deallocation" that is used to create a Free or Delete routinue for each type. An example taken from Ada.Text_IO is: -- Text_AFCB is a predefined record. procedure AFCB_Free (File : access Text_AFCB) is type FCB_Ptr is access all Text_AFCB; FT : FCB_Ptr := FCB_Ptr (File); procedure Free is new Ada.Unchecked_Deallocation (Text_AFCB, FCB_Ptr); begin Free (FT); end AFCB_Free; In , Rob Solomon writes: >I am trying to understand how pointers work in Ada. I would like to >know if I have the correct equivalencies > >Assume this declaration: > type List_Node; -- An incomplete type declaration. > type List_Node_Access is access List_Node; > type List_Node is > record > Data : Integer; > Next : List_Node_Access; > end record; > >Ada Modula-2 (or Pascal) >-------------------------------- ---------------------- >type Node_Access is access Node; TYPE NodeAccess = POINTER TO Node; >Start : Node_Access; VAR Start : NodeAccess; >Current := new Node; Current := NEW(Node); >Current := Start; Current := Start; >Current.all := Start.all; Current^ := Start^; >Current.Data := 5; Current^.Data := 5; > > >I never learned C or derivatives. So comparisons to C don't help me. > >Thanks