From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Pointer types (I mean access types)
Date: Sun, 12 Jul 2009 02:03:07 -0700 (PDT)
Date: 2009-07-12T02:03:07-07:00 [thread overview]
Message-ID: <26a10932-a297-4392-abe2-6d235f056059@r34g2000vba.googlegroups.com> (raw)
In-Reply-To: t9lf55t55qh7puub368vnr55pf215d9nmh@4ax.com
On Jul 11, 2:03 am, Rob Solomon <use...@drrob1-noreply.com> 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.
prev parent reply other threads:[~2009-07-12 9:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-11 0:03 Pointer types (I mean access types) Rob Solomon
2009-07-11 0:59 ` Adam Beneschan
2009-07-11 1:23 ` Randy Brukardt
2009-07-11 9:01 ` Hibou57 (Yannick Duchêne)
2009-07-11 19:41 ` anon
2009-07-12 9:03 ` Gautier write-only [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox