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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ed6a891101ff4e06 X-Google-Attributes: gid103376,public From: Niklas Holsti Subject: Re: Freeing Pointers to classwide types Date: 1998/10/09 Message-ID: <361E65A8.36082B5D@icon.fi>#1/1 X-Deja-AN: 399467707 Content-Transfer-Encoding: 7bit References: <1ftmFTC69GA.191@samson.airnet.net> Content-Type: text/plain; charset=us-ascii Organization: Space Systems Finland Ltd Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-10-09T00:00:00+00:00 List-Id: Matthew Heaney wrote: [snip] > I like each specific type in the hierarchy to maintain its own free list > of already-allocated objects. Provide a class-wide operation that > dynamically dispatches a private Do_Free op. Something like: > > package P is > > type T is abstract null record; (* need "tagged" here) > > type T_Access is access all T'Class; > for T_Access'Storage_Size use 0; > -- > -- By making this have a storage size of zero, you force > -- clients to call a constructor (allocator) for the specific > -- type. I don't see how the commented statement follows from the LRM text on the Storage_Size attribute. I'm looking mainly at LRM 3.11(18), which says that the actual size with be _at least_ the one specified, so even though you specify zero, the size could be a million units. In fact, the above code elicits the following message from GNAT: "Warning: implicit call of Initialize will raise Storage_Error." Could you explain how your suggestion works? Niklas Holsti