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,CP1252 Path: g2news2.google.com!postnews.google.com!t33g2000yqe.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Pointer types (I mean access types) Date: Sat, 11 Jul 2009 02:01:40 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 86.75.149.222 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247302901 16860 127.0.0.1 (11 Jul 2009 09:01:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Jul 2009 09:01:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t33g2000yqe.googlegroups.com; posting-host=86.75.149.222; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6975 Date: 2009-07-11T02:01:40-07:00 List-Id: On 11 juil, 03:23, "Randy Brukardt" wrote: > Looks right to me, although it has been so long since I used Pascal that = I > could have forgotten something. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 R= andy. About =93 New =94, I've just checked it in the FreePascal (also previously known as FPC or FPK) reference. It is indeed declared as: > procedure New (var P: Pointer); > procedure New(var P: Pointer; Cons: TProcedure); The second version is to be used with a constructor. (I had forgot it, I didn't use to use it a lot) But the form TObject.Create, which is a function, is perhaps more common now (at least to me). On 11 juil, 02:59, Adam Beneschan wrote: > =A0 =A0Current.all.Data :=3D 5; > > although nobody does. =A0It's equivalent to > > =A0 =A0Current.Data :=3D 5; > > Hope this helps a little, > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Adam The implicit dereference avoid to have to rewrite source when a compononent or a variable switch from a reference to an instance or vice-versa. On 11 juil, 02:59, Adam Beneschan wrote: > I don't know Modula-2. An attempt to get the best of Pascal while solving its fallbacks (a bit like Ada did). There was also Oberon in this place, which in turned tried to solve some of the fallbacks of Modula. Oberon was a project at ETHZ (Eidgen=F6ssische Technische Hochschule Z=FCrich).... just like Eiffel was ;) (lot of good things in the same place) On 11 juil, 02:03, Rob Solomon wrote: >[...] > type Node_Access is access Node; TYPE NodeAccess =3D POINTER TO Node; > > [...] > Thanks You also have an easy goody with Ada 2005 : the null exclusion. This allow you to tell that a given pointer type (which may be an anonymous type, i.e. a type without a name) must never be null. You may do it like this: > type Node_Access is not null access Node; But becareful while declaring a variable of this type : this will have to be obviously initialize. If you want to restrict access to read only, use =93 type Node_Access is access constant Node =94. Just like as with Pascal, you may also have =93 pointers =94 to procedures in Ada. To get it, just do =93 type Callback_Procedure is not null access procedure (...); =94 A less easy struff: one more aspect you will learn later (take the time you need) is storage pool. You may sometime got compilation error suggesting you to add the =93 all =94 access modifier, to get something =93 type Node_Access is access all Node =94. This =93 all =94, which is not the same which is intended for explicite dereference, means that your access type is intended to access data stored in any sorage pool.