From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Examining individual bytes of an integer
Date: Wed, 17 Oct 2018 16:57:06 -0500
Date: 2018-10-17T16:57:06-05:00 [thread overview]
Message-ID: <pq8b7i$k1r$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: pq6qp0$1nbs$1@gioia.aioe.org
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:pq6qp0$1nbs$1@gioia.aioe.org...
> On 2018-10-17 00:35, Randy Brukardt wrote:
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>> news:pq4jjh$5ig$1@gioia.aioe.org...
>>> On 2018-10-16 12:18, AdaMagica wrote:
>>>
>>>> OK, I stay corrected. But I still claim that it would be extremely
>>>> unfair
>>>> of a compiler not to follow this advice (A'Address = A
>>>> (A'First)'Address
>>>> with increasing addresses for further components).
>>>
>>> It is a real pain when writing storage pools that must do some
>>> bookkeeping
>>> around allocated objects. There should really be X'Allocation_Address
>>> there in addition.
>>
>> Meaning what?
>
> Meaning the first address of the object, e.g. of the dope of an indefinite
> array as it was returned by the allocator:
>
> Allocation_Address := Pointer_To_Object.all'Address - Offset;
>
> Presently the offset to the object beginning must be estimated during
> run-time.
I see. Janus/Ada allocates descriptors separately from the rest of the
object (there will be two calls to Allocate in such a case), and the
descriptor contains a pointer at the data. We did that in large part because
it's necessary to support slice actuals: in that case, the bounds and data
location can be different than those for the original object. (And we didn't
want a lot of different representations, it's hard enough when there are
just a handful.)
> Another, probably more ugly method is create a fake storage pool with
> Deallocate storing its address argument without doing actual deallocation.
> The object's access type is cast to the fake-pool-specific access type.
> Unchecked_Deallocation called. The stored value is the true address.
Yuk. This is why 'Address returns the descriptor in Janus/Ada. You can
always get to the data with indexing.
Randy.
next prev parent reply other threads:[~2018-10-17 21:57 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-14 19:15 Examining individual bytes of an integer Henrik Härkönen
2018-10-14 19:55 ` Jeffrey R. Carter
2018-10-14 21:28 ` Niklas Holsti
2018-10-15 10:18 ` AdaMagica
2018-10-15 18:43 ` Niklas Holsti
2018-10-15 20:18 ` Randy Brukardt
2018-10-16 10:18 ` AdaMagica
2018-10-16 11:55 ` Dmitry A. Kazakov
2018-10-16 22:35 ` Randy Brukardt
2018-10-17 8:10 ` Dmitry A. Kazakov
2018-10-17 9:47 ` briot.emmanuel
2018-10-17 10:04 ` Dmitry A. Kazakov
2018-10-17 21:57 ` Randy Brukardt [this message]
2018-10-16 22:33 ` Randy Brukardt
2018-10-17 6:51 ` Niklas Holsti
2018-10-17 22:01 ` Randy Brukardt
2018-10-17 8:17 ` Dmitry A. Kazakov
2018-10-17 22:03 ` Randy Brukardt
2018-10-17 22:10 ` Randy Brukardt
2018-10-18 8:01 ` Dmitry A. Kazakov
2018-10-18 9:33 ` AdaMagica
2018-10-18 21:18 ` Randy Brukardt
2018-10-19 6:27 ` Niklas Holsti
2018-10-19 8:28 ` AdaMagica
2018-10-19 16:38 ` Niklas Holsti
2018-10-14 21:04 ` Niklas Holsti
2018-10-15 7:49 ` Niklas Holsti
2018-10-15 8:55 ` Simon Wright
2018-10-15 10:52 ` Björn Lundin
2018-10-14 23:42 ` Matt Borchers
2018-10-14 23:45 ` Matt Borchers
2018-10-15 9:02 ` Simon Wright
2018-10-15 7:29 ` Dmitry A. Kazakov
2018-10-15 9:05 ` Simon Wright
2018-10-15 16:11 ` Simon Wright
2018-10-15 20:27 ` Randy Brukardt
2018-10-15 5:37 ` Henrik Härkönen
2018-10-15 7:42 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox