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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Examining individual bytes of an integer Date: Tue, 16 Oct 2018 17:33:01 -0500 Organization: JSA Research & Innovation Message-ID: References: <9d90fa3e-f800-4086-bf97-a65474a8140a@googlegroups.com> <4ddbc9bf-0e2e-466d-8238-d8f709b985e1@googlegroups.com> <35f53cd9-4979-49b8-a5df-2c1cf0764507@googlegroups.com> Injection-Date: Tue, 16 Oct 2018 22:33:02 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="16322"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:54608 Date: 2018-10-16T17:33:01-05:00 List-Id: "AdaMagica" wrote in message news:35f53cd9-4979-49b8-a5df-2c1cf0764507@googlegroups.com... > Am Montag, 15. Oktober 2018 22:18:16 UTC+2 schrieb Randy Brukardt: >> "Niklas Holsti" wrote in message >> news:g2k5fbF9thnU1@mid.individual.net... >> > On 18-10-15 13:18 , AdaMagica wrote: >> >> There is the old Dewar rule that no compiler is doing nonsense. It >> >> would be a very unfriendly compiler to not follow this advice. >> > >> > As I remember it, Dewar's rule says that the Ada *RM* does not specify >> > nonsense, meaning that if some reading of the RM seems to be nonsense, >> > it >> > is the wrong reading. >> >> That's correct. >> >> > I don't remember Dewar saying anything similar about compilers. >> >> Me either. Compilers do nonsense all of the time (usually not on purpose, >> though). > > OK, I stay corrected. But I still claim that it would be extremely unfair > of a compiler not to follow this advice (A'Address = A (A'First)'Address > with increasing addresses for further components). > > I'm apt to try a wager that Randy agrees. Praps I'm gonna lose again... > Tant pis! You would. For Janus/Ada, that's true only for statically constrained arrays. For an unconstrained array, the 'Address points at the array descriptor, and for dynamically constrained array, it points at the indirect address. That's the model for the entire compiler: all objects are statically sized, and if needed, the actual data is found by indirection. Because of the Implementation Advice. I've considered changing 'Address to point at the first data item. But that then does not work for address clauses for unconstrained array types (those have to point at the descriptor). Nor does it work for code that needs to look at the descriptor (not much of that, of course). Given that pretty much no one should be using 'Address anyway, this hasn't been an issue in practice, so it's not a high priority to deal with. Randy.