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!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool1.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> Date: Tue, 3 Oct 2006 10:36:46 +0200 Message-ID: <87fgklu009fm$.1jy0dch55kk6a.dlg@40tude.net> NNTP-Posting-Date: 03 Oct 2006 10:36:42 CEST NNTP-Posting-Host: 73f5dc00.newsspool4.arcor-online.net X-Trace: DXC=Nbeh3dQ`7NP5TOT9_N5i\BH3YR1h@;:3QP9_RDNcfSJ;bb[UIRnRBaCd 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