From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,XPRIO autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.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: Custom Storage Pool questions Date: Mon, 20 Sep 2021 18:48:02 -0500 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Mon, 20 Sep 2021 23:48:04 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="23123"; 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; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:62789 List-Id: "Dmitry A. Kazakov" wrote in message news:shpf4d$1a6s$1@gioia.aioe.org... > On 2021-09-14 02:48, Jere wrote: ... > The problem with unconstrained arrays is not that the bounds are not > allocated, they are, but the semantics of X'Address when applied to > arrays. > > A'Address is the address of the first array element, not of the array > object. For a pool designer it constitutes a problem of getting the array > object by address. This is what Emmanuel discusses in the blog. Right, this is why Janus/Ada never "fixed" 'Address to follow the Ada requirement. (Our Ada 83 compiler treats the "object" as whatever the top-level piece is, for an unconstrained array, that's the bounds -- the data lies elsewhere and is separately allocated -- something that follows from slice semantics.) I suppose your suggestion of implementing yet-another-attribute is probably the right way to go, and then finding every use of 'Address in existing RRS Janus/Ada code and changing it to use the new attribute that works "right". Randy. > [ The motivation behind Ada choice was probably to keep the semantics > implementation-independent. ] > > Consider for example a list of String elements. When Allocate is called > with String, it returns the address of all String. But that is not the > address you would get if you applied 'Address. You have to add/subtract > some offset in order to get one from another. > > In Simple Components this offset is determined at run-time for each > generic instance. > > Of course, a proper solution would be fixing Ada by adding another address > attribute: > > X'Object_Address > > returning the first address of the object as allocated. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de