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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9026b81108642ee X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!newsfeed.utanet.at!newsfeed01.chello.at!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Address of an object Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <382nx7mt637x$.6hjqgb4zxzss.dlg@40tude.net> Date: Sat, 16 Sep 2006 19:06:18 +0200 Message-ID: NNTP-Posting-Date: 16 Sep 2006 19:06:02 CEST NNTP-Posting-Host: 2aeb0b0d.newsspool4.arcor-online.net X-Trace: DXC=j]K:6FRn>kYE47KDAk81NW4IUK\BH3YROVf4a_6cY_UDNcfSJ;bb[UIRnRBaCd On Sat, 16 Sep 2006 09:21:51 -0400, Stephen Leake wrote: > "Dmitry A. Kazakov" writes: > >> Both X'Address and Unchecked_Conversion of a pointer to X would not give >> the true address of X (i.e. the address returned by Allocate of the >> corresponding storage pool). For an array type, X'Address is the address of >> the first element, the dope is out. >> >> Is there any better way > > A better way to do what? > > What are you doing, that either X'Address or X'Access is wrong? Both are. Do the following under GNAT: type P is access String; for P'Storage_Pool use My_Pool; procedure Allocate (Pool : My_Pool; Addr : out Storage_Address; ...) is begin ... Addr := A; end Allocate; P := new String'("abc"); Then compare A with P.all'Address. They will differ. A = P.all'Address - 8, I guess. [ It is not yet another bug of GNAT, it is a proper behavior. ARM explicitly requires this.] See also my response to Adam. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de