comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Ada and string literals
Date: Thu, 31 Jan 2013 07:49:29 -0800 (PST)
Date: 2013-01-31T07:49:29-08:00	[thread overview]
Message-ID: <619a9cd8-ba12-4d25-b1b9-de30d416b54a@googlegroups.com> (raw)
In-Reply-To: <wccpq0mccqb.fsf@shell01.TheWorld.com>

On Wednesday, January 30, 2013 6:23:08 PM UTC-8, Robert A Duff wrote:
> Jeffrey Carter writes:

> '[Unchecked_]Access is about object identity.
> On the other hand 'Address is not -- two objects can have
> the same address without being the same object.

However, if two objects have the same 'Address, it's hard to imagine them not having the same 'Access as well, in practice.  There aren't many cases where this is an issue, but:

   procedure P (Addr : in System.Address) is

      X : aliased T;
      for X'Address use Addr;
      pragma Import (Ada, X);

      Y : aliased T;
      for Y'Address use Addr;
      pragma Import (Ada, Y);

      XA : T_Acc := X'Access;
      YA : T_Acc := Y'Access;

      ...

      if XA = YA then ...

   end Proc;

Assuming T is a simple record type, for instance, I can't imagine XA=YA being false in any implementation, even though I believe X and Y are distinct objects by the RM's definitions.  The additional logic and/or storage required to make sure XA /= YA would be unacceptable distributed overhead.

(This may or may not apply to unconstrained String subtypes such as in the example; if an implementation already uses an implicit level of indirection somewhere to implement those, then it may be possible that 'Address would be the same and 'Access different without any additional overhead.)

                               -- Adam 



  reply	other threads:[~2013-01-31 15:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30  0:44 Ada and string literals codeallergy
2013-01-30  7:08 ` Niklas Holsti
2013-01-30 11:50   ` Mart van de Wege
2013-01-30 13:52     ` Niklas Holsti
2013-01-30 16:09       ` Adam Beneschan
2013-02-01  0:54       ` Shark8
2013-02-01  9:03         ` Niklas Holsti
2013-02-01 14:58           ` Shark8
2013-01-30 16:52     ` codeallergy
2013-01-30 17:19       ` Adam Beneschan
2013-01-30 20:02       ` Simon Wright
2013-01-30 20:19         ` Georg Bauhaus
2013-01-30 22:06       ` Robert A Duff
2013-01-30 22:10         ` Jeffrey Carter
2013-01-31  2:23           ` Robert A Duff
2013-01-31 15:49             ` Adam Beneschan [this message]
2013-01-31 22:24               ` Robert A Duff
2013-02-01 21:16       ` gautier_niouzes
2013-02-02  1:55       ` Stephen Leake
2013-02-02 14:30         ` Robert A Duff
2013-01-31  9:20     ` ake.ragnar.dahlgren
2013-01-30 16:20   ` Robert A Duff
2013-02-01 13:20     ` Stephen Leake
2013-02-01 14:49       ` Robert A Duff
2013-02-01 17:23       ` Dmitry A. Kazakov
2013-02-01 20:22         ` Robert A Duff
2013-02-01 22:03           ` Dmitry A. Kazakov
2013-01-30 22:54 ` codeallergy
2013-02-01  0:50 ` Shark8
replies disabled

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