From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: controlled types and point of instanciation
Date: Fri, 16 Mar 2018 11:06:56 -0700 (PDT)
Date: 2018-03-16T11:06:56-07:00 [thread overview]
Message-ID: <14ed4d30-f4ea-4a5e-9c32-ab689df7a1d5@googlegroups.com> (raw)
In-Reply-To: <c016f55f-417f-42c9-84cf-ea68052ebd22@googlegroups.com>
By the way, I may ask something else related to pointers and this book. Does the preliminary test of this function seems ok ?
function Pointer (Value : Access_Type) return Pointer_Type is
Object : Pointer_Type;
begin
if Object.Pointer /= null then
Delete_Item (Object.Pointer.Value);
else
Object.Pointer := new Reference_Counted_Object;
end if;
Object.Pointer.all := (Value => Value, Count => 1);
return Object;
end Pointer;
That Pointer_type has no default values whatsoever, so it doesn't seems necessary to me.
its structure is
type Pointer_Type is new Ada.Finalization.Controlled with
record
Pointer : Reference_Counted_Pointer;
end record;
and Pointer is a banal access type.
type Reference_Counted_Pointer is access Reference_Counted_Object;
type Reference_Counted_Object is
record
Value : Access_Type; -- > from generic parameter, points at a non limited unconstrained type.
type Access_Type is access Item_Type;
Count : Natural;
end record;
next prev parent reply other threads:[~2018-03-16 18:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 14:39 controlled types and point of instanciation Mehdi Saada
2018-03-16 16:31 ` J-P. Rosen
2018-03-16 17:14 ` Mehdi Saada
2018-03-16 18:06 ` Mehdi Saada [this message]
2018-03-16 21:44 ` Jeffrey R. Carter
2018-03-17 0:54 ` Mehdi Saada
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox