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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b860b4e8d00468ef X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews2.google.com!not-for-mail From: duggar@mit.edu (Keith H Duggar) Newsgroups: comp.lang.ada Subject: Re: Ada access vs C/C++ pointers and references Date: 19 Aug 2004 08:33:59 -0700 Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 129.34.20.23 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1092929639 5806 127.0.0.1 (19 Aug 2004 15:33:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 19 Aug 2004 15:33:59 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:2857 Date: 2004-08-19T08:33:59-07:00 List-Id: > No. This is just syntax. "." would have worked just fine for > dereferencing C/C++ pointers. I suspect the reason for using "->" was > just to make it more visible that you are using a pointer. Originally in C "x->" was shorthand for "(*x)." However, in C++ "->" serves the very useful purpose of (via operator overloading) allowing smart pointer types and iterator types to have the same semantics of raw pointers in addition to allowing the usual member access. Thus iterator->f() //access f() in object "pointed" to smart_pointer->f() //access f() in object "pointed" to iterator.f() //access f() in iterator object smart_pointer.f() //access f() in smart pointer object Otherwise, if the pointed to type had a function named f and the iterator had a function named f which function would interator.f() access? How is this resolved in Ada? Also, I'm sure there were C compatibility constraints as well.