comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Ada Address = C pointer ?
Date: Tue, 30 Oct 2001 20:23:28 GMT
Date: 2001-10-30T20:23:28+00:00	[thread overview]
Message-ID: <4%DD7.92043$gT6.48038153@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: mailman.1004464900.6921.comp.lang.ada@ada.eu.org

> Somehow I feel more assured with Address_To_Access_Conversions.
> Actually it is more than just a feeling, according to
> http://adapower.com/lang/accessmem.html .
  That is an unfortunate reference since it contains a couple of errors
that have led you astray.  In particular:

>   S : XString;
>   for S'Address use A;
>
> This will likely work on most implementations, assuming that
> they do not use dope vectors or descriptors for constrained
> arrays. This is a reasonable assumption, and certainly true
> of GNAT,
  It certainly seems that it *must* work on compilers that follow the
implementation advice ARM 13.3(14) "For an array X, X'Address should point
at the first component of the array, ..."  It was perhaps more of a
problem in Ada 83.

> Method 1b.  Use Unchecked_Conversion
>   in practice, this works fine, since all
>   implementations will use the same representation
>   for constrained pointers and addresses.
  This is simply incorrect.  There exist counterexamples.

As it says, the System.Address_To_Access method is preferable in
Ada 95, but was not available in Ada 83.  The web page says nothing
about Interfaces.C, which presumably are supposed to let you avoid
this kind of bare metal System.Address stuff entirely.

Hopefully Robert Dewar will update the web page.



  reply	other threads:[~2001-10-30 20:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-26 18:53 Ada Address = C pointer ? M. A. Alves
2001-10-26 18:09 ` Lutz Donnerhacke
2001-10-26 21:06   ` Florian Weimer
2001-10-26 19:34 ` Mark Johnson
2001-10-26 23:39   ` tmoran
2001-10-29 13:07     ` M. A. Alves
2001-10-29 20:19       ` Matthew Heaney
2001-10-29 23:15         ` tmoran
2001-10-30 10:30           ` M. A. Alves
2001-10-30 19:53             ` tmoran
2001-10-31 13:01               ` M. A. Alves
2001-10-31 14:44                 ` Marin David Condic
2001-10-30  9:58         ` M. A. Alves
2001-10-30 12:02           ` Lutz Donnerhacke
2001-10-30 12:53             ` M. A. Alves
2001-10-30 12:56               ` Lutz Donnerhacke
2001-10-30 14:26                 ` M. A. Alves
2001-10-30 14:19               ` Matthew Heaney
2001-10-30 14:41                 ` M. A. Alves
2001-10-30 17:10           ` Mark Johnson
2001-10-30 18:01             ` M. A. Alves
2001-10-30 20:23               ` tmoran [this message]
2001-10-31 13:13                 ` M. A. Alves
2001-10-30 19:53           ` tmoran
2001-10-29 23:15       ` tmoran
replies disabled

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