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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!RKN7TKnHC01q0gdg6EhkbQ.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Custom Storage Pool questions Date: Fri, 17 Sep 2021 08:18:20 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <1d2551f4-8189-44ec-a54d-4a56a672bedcn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="5323"; posting-host="RKN7TKnHC01q0gdg6EhkbQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:qovlyQ67V95KqdBkck7o8Nxizp4= Xref: reader02.eternal-september.org comp.lang.ada:62760 List-Id: Jere writes: > On Thursday, September 16, 2021 at 3:13:00 AM UTC-4, Emmanuel wrote: >> In the case of the GNATCOLL headers pool, we need to allocate more >> because the user wants to store extra data. For that data, we are >> left on our own to find the number of bytes we need, which is part of >> the computation we do: we of course need the number of bytes for the >> header's object_size, but also perhaps some extra bytes that are not >> returned by that object_size in particular for controlled types and >> arrays. >> Note again that those additional bytes are for the header type, not >> for the type the user is allocating (for which, again, the compiler >> already passes the number of bytes it needs). > Thanks for the response Emmanuel. That clears it up for me. I think > the confusion for me came from the terminology used then. In the > blog, that extra space for First/Last and Prev/Next was mentioned as > if it were for the element, which I mistook was the user's object > being allocated and not the header portion. I didn't catch that as > the generic formal's name, so that is my mistake. Given this diagram from the blog, you can hardly be blamed (says a person who leapt to the same conclusion): +--------+-------+------+----------+------+---------+ | Header | First | Last | Previous | Next | Element | +--------+-------+------+----------+------+---------+