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,d0475d4d02ffd8d9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news.glorb.com!ecngs!feeder.ecngs.de!news.osn.de!diablo2.news.osn.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: To collection (GNAT bug) 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: <1fo8mdcya4lc1.1xzuim6fz5a6a.dlg@40tude.net> Date: Sun, 1 Oct 2006 10:00:43 +0200 Message-ID: NNTP-Posting-Date: 01 Oct 2006 10:00:24 CEST NNTP-Posting-Host: b9d5b1cb.newsspool3.arcor-online.net X-Trace: DXC=AKQo:D^W5_=_A0jCfgHO6>McF=Q^Z^V384Fo<]lROoR14nDHegD_]R5b_W4;P3d:h2DNcfSJ;bb[5IRnRBaCd;n6`j\Nc@R7Dc6ZDE]`9X4 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6820 Date: 2006-10-01T10:00:24+02:00 List-Id: On Sun, 01 Oct 2006 01:21:22 GMT, Jeffrey R. Carter wrote: > Dmitry A. Kazakov wrote: >> The following does not work in GCC 4.1.1 (20060525), as well as in 3.15p > > Why should it? There's no guarantee that unchecked conversion between > access values and System.Address will give meaningful results. See ARM 13.9 (17), which requires reversibility of Unchecked_Conversion. That is clearly violated in the example given. Though it is legal not to provide address to access type conversion through Unchecked_Conversion, it is still illegal to provide it wrong. > Use System.Address_To_Access_Conversions. Address_To_Access_Conversions serves a different purpose. It declares a new access type, moreover it is a general access type. BTW, when Address_To_Access_Conversions is composed with an access to access type conversion, the problem persists (it is a bug after all (:-)) Replace To_Ptr and To_Addr with: package Clutter is new Address_To_Access_Conversions (String); function To_Addr (X : Ptr) return Address is begin return Clutter.To_Address (X.all'Unchecked_Access); end To_Addr; function To_Ptr (X : Address) return Ptr is function Cast is new Ada.Unchecked_Conversion (Clutter.Object_Pointer, Ptr); begin return Cast (Clutter.To_Pointer (X)); end To_Ptr; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de