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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham 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!postnews.google.com!r34g2000vba.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: Pointer types (I mean access types) Date: Sun, 12 Jul 2009 02:03:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <26a10932-a297-4392-abe2-6d235f056059@r34g2000vba.googlegroups.com> References: NNTP-Posting-Host: 85.1.192.92 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1247389387 28512 127.0.0.1 (12 Jul 2009 09:03:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 12 Jul 2009 09:03:07 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r34g2000vba.googlegroups.com; posting-host=85.1.192.92; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7009 Date: 2009-07-12T02:03:07-07:00 List-Id: On Jul 11, 2:03 am, Rob Solomon wrote: > 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; Would be type NodeAcces = ^Node in Pascal IIRC ... > 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; Seems fine to me (I had a course in Modula-2; never had in Ada :-) ). Note that Ada's "Current.Data := 5" is a shortcut for "Current.all.Data := 5" G.