Jump to content

Ada Programming/Attributes/'Pool Address

From Wikibooks, open books for an open world

Description

[edit | edit source]

X'Pool_Address for any object X returns the address of X within its storage pool. This is the same as X'Address, except that for an unconstrained array whose bounds are allocated just before the first component, X'Pool_Address returns the address of those bounds, whereas X'Address returns the address of the first component.

Here, we are interpreting ‘storage pool’ broadly to mean wherever the object is allocated, which could be a user-defined storage pool, the global heap, on the stack, or in a static memory area. For an object created by new, Ptr.all'Pool_Address is what is passed to Allocate and returned from Deallocate.