comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: To collection (GNAT bug)
Date: Tue, 3 Oct 2006 10:36:46 +0200
Date: 2006-10-03T10:36:42+02:00	[thread overview]
Message-ID: <87fgklu009fm$.1jy0dch55kk6a.dlg@40tude.net> (raw)
In-Reply-To: R%dUg.1005204$084.190515@attbi_s22

On Mon, 02 Oct 2006 19:45:53 GMT, Jeffrey R. Carter wrote:

> Dmitry A. Kazakov wrote:
>> 
>> OK, it can be classified as implementation-defined, because the compiler
>> designer can always claim that Address representation is not the pointer's
>> one. Who could rebut him?
> 
> Since you say elsewhere that it gave you a warning about the sizes being 
> different, it would appear that this is in fact the case.

Even if the sizes were same, and even if the bit patterns were exactly
same, one could always claim that representations are different.

>> 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. ]
> 
> This is unchecked programming, where the programmer is telling the 
> compiler, "I know what I'm doing, even if it looks like I don't."

No. These aren't equivalent. In many cases the programmer does not know
what he is doing on the level of bits and bytes. Otherwise he probably
wouldn't instantiate Unchecked_Conversion, but wrote a conversion of his
own. He only knows the semantics of an object and asks the compiler to
convert the types according to this semantics. It is a deal - the
programmer knows the semantics, the compiler does the representation.

> And, 
> of course, even when he doesn't. Perhaps you know that the 1st 4 bytes 
> of the access value are an address. So the compiler can warn you, but it 
> shouldn't prevent you.

Hmm, warning makes sense when the suspicious construct might turn either
wrong or correct depending on the context, which were difficult or
impossible to check. A conversion that creates a garbage dope is always
wrong.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2006-10-03  8:36 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 [this message]
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
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox