comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: address/access/pointer confusion
Date: Wed, 20 Oct 2004 18:55:56 +0200
Date: 2004-10-20T18:55:56+02:00	[thread overview]
Message-ID: <4867610.6NcCWSqDf3@linux1.krischik.com> (raw)
In-Reply-To: 1c2f5137.0410200556.70a1518c@posting.google.com

Hans Van den Eynden wrote:

> On
>
http://groups.google.com/groups?hl=nl&lr=&threadm=wvbr657egsa1.fsf%40sun.com&prev=/groups%3Fnum%3D25%26hl%3Dnl%26lr%3D%26group%3Dcomp.lang.ada%26start%3D300
> I read
> 
>> First, is it correct to say that Ada access types are more
>> similar to C++ references (T&) than they are to C/C++
>> pointers (T*) ?
> 
> No. Ada access types are very similar to C and C++ pointers, and are
> typically implemented and used in (almost) exactly the same way.
> 
> On
>
http://groups.google.com/groups?hl=nl&lr=&threadm=ss%25ad.1636%246k2.1252%40newsread3.news.pas.earthlink.net&prev=/groups%3Fhl%3Dnl%26lr%3D%26group%3Dcomp.lang.ada
> I read
> 
> Well an access is not a pointer. System.Address is a pointer.  There
> are
> functions to convert an access to an Address..An access may contain
> additional informations apart from the pointer - like size of the
> object
> pointed to (for indefinite objects), a reference counter (for access
> all or
> anonymous access) etc. pp.
> 
> I think that not the same definition??
> Can anybody tell me the exact difference between pointer in C++ and
> access/address types in Ada???


Well an Address is closest to an void*. As it is an address of some object
in memory.

An Access could be several things. Depending on you compiler vendor it could
be normal pointer, or a smart pointer or a handle.

The representation of an access can also be influenced. For example you can
use pragma Convention (C, ...) to make an access C compatible.

Or you can use For A'Storrage_Pool use ... to handle you own memory.

Or you use "access all" to have an access which can point to non heap
memory.

In an Acceess is more then just a pointer or reference.

With Regards.

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




  reply	other threads:[~2004-10-20 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 13:56 address/access/pointer confusion Hans Van den Eynden
2004-10-20 16:55 ` Martin Krischik [this message]
2004-10-20 18:51 ` skidmarks
2004-10-20 23:37   ` Georg Bauhaus
2004-10-21  7:30   ` Jacob Sparre Andersen
2004-10-22  1:14     ` Jeffrey Carter
replies disabled

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