From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada access vs C/C++ pointers and references
Date: Thu, 19 Aug 2004 10:11:01 +0200
Date: 2004-08-19T10:11:01+02:00 [thread overview]
Message-ID: <1g8jhtbcbk0e5$.19jsic6idgcet.dlg@40tude.net> (raw)
In-Reply-To: b47de02.0408181427.25d82fe1@posting.google.com
On 18 Aug 2004 15:27:47 -0700, Keith H Duggar wrote:
> First, is it correct to say that Ada access types ore more
> similar to C++ references (T&) than they are to C/C++
> pointers (T*) ?
I wouldn't say so. References in C++ have three major uses:
1. Parameter passing mode specification:
T& Foo (T& X);
2. Aliasing:
T& X = *Y [123].Z ()->Baz;
3. Mix-in:
class Y
{
T& X;
In Ada only 3 is customary implemented using access types:
1. Some types are always by-copy, some are always by-reference, and for the
rest the compiler is free to choose the best.
2. Aliasing is achieved by renaming:
X : T renames Y(123).Z().Baz.all;
3. Only for mix-in one usually uses anonymous access types:
type Y (X : access T) is ...
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
prev parent reply other threads:[~2004-08-19 8:11 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
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 [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