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,81633e7277ffacee X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada containers and custom allocators 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: <472f2c87-1238-42a5-8b94-92e9b70981da@f47g2000hsd.googlegroups.com> <1rny29vw3pipd$.oppchvpo4gnf$.dlg@40tude.net> Date: Wed, 9 Jan 2008 18:09:45 +0100 Message-ID: <15hfjzq5cr38z.8ffcg9kk0ibm.dlg@40tude.net> NNTP-Posting-Date: 09 Jan 2008 18:09:49 CET NNTP-Posting-Host: 19a5505b.newsspool3.arcor-online.net X-Trace: DXC=g:fgJ_V=]AnMNA X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:19295 Date: 2008-01-09T18:09:49+01:00 List-Id: On Wed, 09 Jan 2008 10:29:46 -0500, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On Tue, 8 Jan 2008 17:54:44 -0600, Randy Brukardt wrote: >> >>> But it isn't valuable enough to force every user >>> of a container to define a storage pool (since there is no name for a >>> standard storage pool). >> >> That always wondered me, why there is no name for. Especially because the >> default storage pool can be obtained anyway: >> >> type Some_Ptr is access Integer; -- Goes to the default storage pool >> package Foo is new Boo (Some_Ptr'Storage_Pool); > > The compiler is not required to use the same storage pool for all > types. Therefore, the concept "THE default pool" does not exist. > > Some_Ptr'Storage_Pool might be a special pool tuned for the fact that > Size_In_Storage_Elements = 4 and Alignment = 4. Allocate could > add 4 to a known-aligned pointer, and ignore the > Size_In_Storage_Elements and Alignment parameters. > > If Boo uses this pool for something other than Integer, > it might not work. Which is broken then. Because it does not fulfill the contract of Storage_Pool'Class. I guess that Allocate is allowed to raise Storage_Error, but not to ignore parameters. If the implementation handles a family of pools one per object's size power of two or like that, then it should return the family root rather than the size-specific pool. Otherwise, the following will work either: type Integer_Ptr is access Integer; type Character_Ptr is access Character; for Character_Ptr'Storage_Pool use Integer_Ptr'Storage_Pool; I think ARM should clarify the issue of how pools could be constrained while allowing a safe use. > However, I see nothing wrong with having a predefined operation that > returns a suitable pool. Yes. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de