comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent.Guerby@enst-bretagne.fr (Laurent Guerby)
Subject: Re: Access to Address conversion question
Date: 1996/03/22
Date: 1996-03-22T00:00:00+00:00	[thread overview]
Message-ID: <4xn3598nmc.fsf@leibniz.enst-bretagne.fr> (raw)
In-Reply-To: DoMv6y.2p@jvdsys.nextjk.stuyts.nl

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=US-ASCII 19: 52:09 GMT, Size: 1344 bytes --]

Jerry van Dijk writes
: It might be just me again, but I cannot figure out how to convert an access 
: type to an address, as in assigning Address_C in the code below. GNAT (3.03)
: tells me I have an invalid parameter list in the call to To_Address here ?
[source and comments deleted]

You  should have a  close  look   to  the spec of   System.Address_To_
Access_Conversions : (taken from the GNAT sources) 

generic
   type Object (<>) is limited private;
 
package System.Address_To_Access_Conversions is
pragma Preelaborate (Address_To_Access_Conversions);
 
   type Object_Pointer is access all Object;
 
   function To_Pointer (Value : Address)        return Object_Pointer;
   function To_Address (Value : Object_Pointer) return Address;
 
   pragma Convention (Intrinsic, To_Pointer);
   pragma Convention (Intrinsic, To_Address);
 
end System.Address_To_Access_Conversions;

   Once you instanciate it with ab "Object" type,  it provides you the
"access all"  type,  and you should  use this   one to avoid  compiler
complaints about silly type mismatch ;-).

-- 
--  Laurent Guerby, student at Telecom Bretagne (France), Team Ada
--  "Use the Source, Luke. The Source will be with you, always (GPL)"
--  http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project)
--  Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat)




      parent reply	other threads:[~1996-03-22  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-21  0:00 Access to Address conversion question Jerry van Dijk
1996-03-22  0:00 ` Norman H. Cohen
1996-03-23  0:00   ` Jerry van Dijk
1996-03-22  0:00 ` Laurent Guerby [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox