From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!maths.tcd.ie!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Put the access value Date: Mon, 20 Apr 2020 19:02:26 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5e956327$0$1635$e4fe514c@news.kpn.nl> NNTP-Posting-Host: shell02.theworld.com Mime-Version: 1.0 Content-Type: text/plain X-Trace: pcls7.std.com 1587423746 13958 192.74.137.72 (20 Apr 2020 23:02:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 20 Apr 2020 23:02:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:WpWi2Ndn6JlB2dI/6A0Zm0Opm0s= Xref: reader01.eternal-september.org comp.lang.ada:58441 Date: 2020-04-20T19:02:26-04:00 List-Id: "J-P. Rosen" writes: > In Ada, a pointer is not an integer and has no 'Image attribute. Sure it does. ;-) So do records and everything else. See AI12-0020-1 (don't pay attention to details; they're changing). I implemented that recently, so the latest development version of GNAT has it. This program: with Ada.Strings.Text_Output.Formatting; use Ada.Strings.Text_Output; procedure Access_Image is type R is record This : Integer; That : String (1..10); end record; type A is access all R; X : A := new R'(This => 123, That => "helloworld"); begin Formatting.Put ("\1, \2\n", X'Image, X.all'Image); end Access_Image; prints: (access 162b740), (this => 123, that => "helloworld") > 1) Use Unchecked_Conversion to convert it to an appropriate integer type > > 2) use package Address_To_Access conversion to convert your pointer to > an address, then System.Storage_Elements.To_Integer to convert the > address to Integer_Address, which is an integer type. Right, these are good workarounds if you don't have the latest version. - Bob