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!news4.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.hanau.net!noris.net!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> <13weuafrdg7cx$.zkechwsuxyfw.dlg@40tude.net> <1c8Ug.2616$O5.1996@llslave.llan.ll.mit.edu> Date: Mon, 2 Oct 2006 15:43:59 +0200 Message-ID: NNTP-Posting-Date: 02 Oct 2006 15:43:56 CEST NNTP-Posting-Host: a6e10709.newsspool1.arcor-online.net X-Trace: DXC=IV[4_4Fo<]lROoR1gUcjd<3m<;2XF9[6LHn;2LCV>[= X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6841 Date: 2006-10-02T15:43:56+02:00 List-Id: On Mon, 02 Oct 2006 09:06:42 -0400, Frank J. Lhota wrote: > Dmitry A. Kazakov wrote: >> On Sun, 01 Oct 2006 19:23:26 GMT, Jeffrey R. Carter wrote: >> However, I don't think that it was really the intended behavior in this >> case. [ If access String is a fat pointer, then Unchecked_Conversion should >> not be allowed at all. Otherwise it must honor the String's dope. ] > > I would agree that an unchecked conversion between an address and a fat > pointer (or any two types of different sizes, for that matter) should at > least trigger a warning. Well, actually, it gives a warning, that sizes are different. I think that a warning is not enough. But there is a nasty issue with generics. Let Unchecked_Conversion were instantiated in a generic body, then the compiler should either forbid or support conversions of all access types - it never knows if the actual access type were fat. A cleaner way were, IMO, to pass the conversion as a formal parameter and allow ad-hoc instantiations as subprogram defaults. Something like: generic type T is ...; type Ptr is access T; -- It could be fat with function To_Ptr (A : Address) return Ptr is new Ada.Unchecked_Conversion (T, Ptr); package Separately_Compilable_Generic_Body is Then the compiler could safely compile the body and complain upon an instantiation. But it still does not help when the access type is declared within the generic body. Then the compiler should forget about fat pointers. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de