From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Access conversions
Date: 1998/10/12
Date: 1998-10-12T00:00:00+00:00 [thread overview]
Message-ID: <x7v1zoe73ec.fsf@pogner.demon.co.uk> (raw)
I need to write a function
function Is_Member (G : Graph'Class; V : Vertex'Class) return Boolean;
where there is a type
type Graph_Ptr is access all Graph'Class;
and a Vertex has a component Rep with a component Enclosing of type
Graph_Ptr which accesses its enclosing Graph.
In GNAT I can say in Is_Member
return V.Rep.Enclosing = G'Unrestricted_Access;
but of course this isn't portable.
If I say
function To_Ptr is new Ada.Unchecked_Conversion (System.Address,
Graph_Ptr);
and then in Is_Member
return V.Rep.Enclosing = To_Ptr (G'Address);
which appears to work as expected in GNAT and ObjectAda 7.1, am I in
fact riding for a fall?
-Simon
next reply other threads:[~1998-10-12 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-12 0:00 Simon Wright [this message]
1998-10-12 0:00 ` Access conversions Tucker Taft
1998-10-13 0:00 ` Simon Wright
1998-10-12 0:00 ` 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