comp.lang.ada
 help / color / mirror / Atom feed
From: duggar@mit.edu (Keith H Duggar)
Subject: Re: Ada access vs C/C++ pointers and references
Date: 19 Aug 2004 08:33:59 -0700
Date: 2004-08-19T08:33:59-07:00	[thread overview]
Message-ID: <b47de02.0408190733.558c97ba@posting.google.com> (raw)
In-Reply-To: wvbrekm3h830.fsf@sun.com

> 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.



  reply	other threads:[~2004-08-19 15:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18 22:27 Ada access vs C/C++ pointers and references Keith H Duggar
2004-08-19  0:21 ` Nick Roberts
2004-08-19 11:42   ` Marin David Condic
2004-08-19  0:29 ` Jim Rogers
2004-08-19  5:19 ` Ludovic Brenta
2004-08-19  6:21   ` Martin Dowie
2004-08-19 11:55     ` Marin David Condic
2004-08-19 18:01     ` Ludovic Brenta
2004-08-19  7:19   ` j
2004-08-19  7:42     ` Martin Dowie
2004-08-19 12:03     ` Marin David Condic
2004-08-19  7:59 ` Ole-Hjalmar Kristensen
2004-08-19 15:33   ` Keith H Duggar [this message]
2004-08-19 21:32     ` Ludovic Brenta
2004-08-19 22:18       ` Hyman Rosen
2004-08-20  7:52     ` Ole-Hjalmar Kristensen
2004-08-19  8:11 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox