comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Returning ranges from a function (was: How to loop (elegant) throug a vector ?)
Date: Mon, 23 Jun 2008 05:06:26 -0700 (PDT)
Date: 2008-06-23T05:06:26-07:00	[thread overview]
Message-ID: <5f3204b8-5f93-4a65-a7ff-86abb3a839e9@k37g2000hsf.googlegroups.com> (raw)
In-Reply-To: 20080623114742.748d3869@cube.tz.axivion.com

On 23 Cze, 11:47, Stefan Bellon <bel...@software-erosion.org> wrote:

> > What about "independent addressability" from 13.3?

> I don't think this applies here as the array components are not aliased

With my version of GNAT everything is stored at the same location when
"aliased" is added to components of the array.
I can see it by having *equal* access variables created from different
array indices:

with Ada.Text_IO;

procedure A is

   type Empty_Record is null record;
   for Empty_Record'Size use 0;

   A : array (Integer range <>) of aliased Empty_Record := (1 .. 100
=> <>);

   type Empty_Ptr is access all Empty_Record;
   P1 : Empty_Ptr := A (1)'Access;
   P2 : Empty_Ptr := A (2)'Access;

begin

   if P1 = P2 then
      Ada.Text_IO.Put_Line ("Equal access values.");
   else
      Ada.Text_IO.Put_Line ("Distinct access values.");
   end if;

end;

Is it bug or feature?

> But in any case my "range objects" do not rely on the compiler not
> allocating memory.

Right, but they just expose an interesting compiler behavior.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



  reply	other threads:[~2008-06-23 12:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 13:19 How to loop (elegant) throug a vector ? Reinert Korsnes
2008-06-20 14:49 ` Pascal Obry
2008-06-20 17:12 ` Returning ranges from a function (was: How to loop (elegant) throug a vector ?) Stefan Bellon
2008-06-22 14:01   ` Maciej Sobczak
2008-06-22 18:47     ` Stefan Bellon
2008-06-22 21:06       ` Maciej Sobczak
2008-06-23  9:47         ` Stefan Bellon
2008-06-23 12:06           ` Maciej Sobczak [this message]
2008-06-23 12:28             ` christoph.grein
2008-06-20 19:21 ` How to loop (elegant) throug a vector ? Jeffrey R. Carter
2008-06-20 19:48   ` Reinert Korsnes
2008-06-20 23:25     ` Jeffrey R. Carter
2008-06-23 17:14     ` Matthew Heaney
2008-06-23 17:11   ` Matthew Heaney
2008-06-23 17:08 ` Matthew Heaney
replies disabled

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