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,b657b1c99e7e7039 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.erje.net!news.internetdienste.de!newsfeed.velia.net!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: bit numbers in packed arrays of Boolean Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <82r5hfghjr.fsf@stephe-leake.org> <8e4b6rF1dlU1@mid.individual.net> <108mw0hcfwlnl.1klsp2e3omofa.dlg@40tude.net> Date: Tue, 31 Aug 2010 16:07:56 +0200 Message-ID: NNTP-Posting-Date: 31 Aug 2010 16:07:56 CEST NNTP-Posting-Host: 5d805ac1.newsspool4.arcor-online.net X-Trace: DXC=GE?LBYAd7enW;^6ZC`4\`mfM[68DC3PJ_K@F[L`c2 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:13877 Date: 2010-08-31T16:07:56+02:00 List-Id: On Tue, 31 Aug 2010 15:40:40 +0200, Yannick Duch�ne (Hibou57) wrote: > Le Tue, 31 Aug 2010 15:08:02 +0200, Dmitry A. Kazakov > a �crit: >> The representation = memory pattern. When RM says that S and T have same >> representation that is merely same pattern. It tells nothing about ordering >> of bits. Any combination of 8-bits is same representation of Unsigned_8 >> and Boolean array (1..8). > If I understand correctly, this suggests bits representation should be > accessed (read/write) all the same way, whatever the type it implements. The representation is accessed when bytes, words etc are read and written. > A tricky and imaginary example by the way: imagine a clever compiler with > clever optimization, which would detect the application mostly access the > nth item of the array and far less oftenly access any other items, now let > say the target CPU has a special instruction to access bit value at #0 > (common practice on CISC processor), then it could choose to map this nth > item on bit #0. > > Do you feel the language would disallow such an optimization ? if it does > not, this example shows this is implementation defined. AFAIK there is no requirement for Unchecked_Conversion be meaningful. The compiler is allowed do whatever it wishes with the representation if the type semantics is not violated. After all, some objects can be optimized away. What is the representation of a non-resident object? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de