From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: To collection (GNAT bug)
Date: Wed, 4 Oct 2006 14:10:57 +0200
Date: 2006-10-04T14:10:57+02:00 [thread overview]
Message-ID: <1hgjta1aszyil.11y4nqmer9obh.dlg@40tude.net> (raw)
In-Reply-To: 1159954035.16821.10.camel@localhost
On Wed, 04 Oct 2006 11:27:15 +0200, Georg Bauhaus wrote:
> If you would like to have user level internal data structure
> representation interfaces for arrays, pointers, etc.,
No, I don't like to care about them. This is exactly why the
language/compiler provided conversions must be reasonable, or else illegal.
Ada is not C.
> how do you envision a suitably modified Ada compiler to guarantee
> separate compilation, optimization, and LRM-correct
> behavior in the presence of user-defined internal representations?
You should ask this question yourself. In particular, consider the code I
sent once:
package Legal is new Address_To_Access_Conversions (String);
function To_Addr (X : Ptr) return Address is
begin
return Legal.To_Address (X.all'Unchecked_Access);
end To_Addr; -- This is safe
function To_Ptr (X : Address) return Ptr is
function Cast is
new Ada.Unchecked_Conversion (Legal.Object_Pointer, Ptr);
begin
return Cast (Legal.To_Pointer (X));
end To_Ptr;
What is user-defined in To_Ptr (To_Addr (X))?
----------------------
Clearly a lack of safe general to pool specific conversion of access types
is a language design fault. So? Should the compiler vendors make it even
worse, by making Unchecked_Conversion return rubbish when the programmer
resort to it?
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
prev parent reply other threads:[~2006-10-04 12:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-30 19:46 To collection (GNAT bug) Dmitry A. Kazakov
2006-10-01 1:21 ` Jeffrey R. Carter
2006-10-01 8:00 ` Dmitry A. Kazakov
2006-10-01 19:23 ` Jeffrey R. Carter
2006-10-01 22:33 ` Frank J. Lhota
2006-10-02 3:08 ` Jeffrey R. Carter
2006-10-02 13:02 ` Frank J. Lhota
2006-10-02 19:50 ` Jeffrey R. Carter
2006-10-02 8:23 ` Dmitry A. Kazakov
2006-10-02 13:06 ` Frank J. Lhota
2006-10-02 13:43 ` Dmitry A. Kazakov
2006-10-04 17:18 ` Adam Beneschan
2006-10-04 18:51 ` Dmitry A. Kazakov
2006-10-02 19:45 ` Jeffrey R. Carter
2006-10-03 8:36 ` Dmitry A. Kazakov
2006-10-03 19:10 ` Jeffrey R. Carter
2006-10-04 8:01 ` Dmitry A. Kazakov
2006-10-04 9:27 ` Georg Bauhaus
2006-10-04 12:10 ` Dmitry A. Kazakov [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