From: ldries46 <bertus.dries@planet.nl>
Subject: Re: Put the access value
Date: Tue, 14 Apr 2020 14:09:56 +0200
Date: 2020-04-14T14:09:56+02:00 [thread overview]
Message-ID: <5e95a814$0$1701$e4fe514c@news.kpn.nl> (raw)
In-Reply-To: <r745dg$eqh$1@dont-email.me>
Op 14-4-2020 om 13:05 schreef Jeffrey R. Carter:
> On 4/14/20 9:15 AM, ldries46 wrote:
>>
>> type Buffer_Pointer is limited private;
>>
>> type Block_Buffer is record
>> nr : integer;
>> buf : Item;
>> previous : Buffer_Pointer := null;
>> next : Buffer_Pointer := null;
>> end record;
>>
>> El : Buffer_Pointer := LastBuffer;
>> El1 : Buffer_Pointer;
>>
>> I just want to see if the routing of thedifferent Buffer_Pointer's is
>> correct so I thought Buffer_Pointer'Image(El) would show the value of
>> The Pointer El f.i. ?x000000 for null or even the simpel decimal
>> value 0.
>
> 1. There are no access types in this code. The declaration of type
> Block_Buffer is invalid because null cannot be a valid visible value
> of type Buffer_Pointer
>
> II. Assuming the full type of Buffer_Pointer is an access type, and
> the declaration of Block_Buffer can see the full type, it appears you
> are creating a linked list. Why not use
> Ada.Containers.Doubly_Linked_Lists?
>
> C. Assuming you're still going to use access types, why are you
> interested in the internal representation of access values? These will
> probably appear to be random values that provide no information,
> except perhaps whether the value is null
>
> iv. If you're only interested in whether an access value is null or
> not, this can be better determined without showing the internal
> representation:
>
> "El is null " & Boolean'Image (El = null)
>
> "El is " & (if El = null then "" else "not ") & "null"
>
Thanks to mr J.P Rosen this worked
and I have checked a Buffer random Buffer insert routinethat looked like
it didn't work but I could see that it in fact worked correctly. I used
the Ada Unchecked conversion.
Mr Carter the Buffer_Pointer is an access declaration which was limited
private. And I just had presented it for the possibility that the
problem should be created by its limited private pro
next prev parent reply other threads:[~2020-04-14 12:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 7:15 Put the access value ldries46
2020-04-14 7:42 ` J-P. Rosen
2020-04-18 15:08 ` Oliver Kellogg
2020-04-20 23:02 ` Robert A Duff
2020-04-21 7:07 ` briot.emmanuel
2020-04-21 22:29 ` Robert A Duff
2020-04-14 11:05 ` Jeffrey R. Carter
2020-04-14 12:09 ` ldries46 [this message]
2020-04-15 7:20 ` briot.emmanuel
2020-04-15 8:02 ` AdaMagica
2020-04-15 8:51 ` J-P. Rosen
2020-04-15 16:23 ` AdaMagica
2020-04-17 14:20 ` Björn Lundin
2020-04-21 21:06 ` Randy Brukardt
2020-04-22 12:31 ` Björn Lundin
2020-04-22 17:33 ` AdaMagica
2020-04-23 11:37 ` Björn Lundin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox