comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Put the access value
Date: Tue, 14 Apr 2020 13:05:18 +0200
Date: 2020-04-14T13:05:18+02:00	[thread overview]
Message-ID: <r745dg$eqh$1@dont-email.me> (raw)
In-Reply-To: <5e956327$0$1635$e4fe514c@news.kpn.nl>

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"

-- 
Jeff Carter
"Your mother was a hamster and your father smelt of elderberries."
Monty Python & the Holy Grail
06

  parent reply	other threads:[~2020-04-14 11:05 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 [this message]
2020-04-14 12:09   ` ldries46
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