13.11.3 Default Storage Pools
Pragma and aspect Default_Storage_Pool specify the
storage pool that will be used in the absence of an explicit specification
of a storage pool or storage size for an access type.
Syntax
The form of a
pragma
Default_Storage_Pool is as follows:
storage_pool_indicator ::= storage_pool_name |
null | Standard
Name Resolution Rules
The
storage_pool_name
is expected to be of type Root_Storage_Pool'Class.
Legality Rules
The
storage_pool_name
shall denote a variable.
If the
pragma
is used as a configuration pragma, the
storage_pool_indicator
shall be either
null or Standard, and it defines the
default
pool
to be the given
storage_pool_indicator
within all applicable compilation units (see
10.1.5),
except within the immediate scope of another
pragma
Default_Storage_Pool. Otherwise, the pragma occurs immediately within
a sequence of declarations, and it defines the default pool within the
immediate scope of the pragma to be the given
storage_pool_indicator,
except within the immediate scope of a later pragma Default_Storage_Pool.
Thus, an inner pragma overrides an outer one.
A
pragma
Default_Storage_Pool shall not be used as a configuration pragma that
applies to a compilation unit that is within the immediate scope of another
pragma Default_Storage_Pool.
Static Semantics
The language-defined aspect Default_Storage_Pool
may be specified for a generic instance; it defines the default pool
for access types within an instance.
.
The Default_Storage_Pool aspect may be specified
as Standard, which is an identifier specific to an aspect (see
13.1.1)
and defines the default pool to be Standard. In this case, there shall
not be a declaration with
defining_identifier
Standard that is immediately visible at the point of the aspect specification,
other than package Standard itself.
Otherwise, the expected type for the Default_Storage_Pool
aspect is Root_Storage_Pool'Class and the
aspect_definition
shall be a
name
that denotes a variable. This aspect overrides any Default_Storage_Pool
pragma that applies to the generic unit; if the aspect is not specified,
the default pool of the instance is that defined for the generic unit.
The effect of specifying the aspect Default_Storage_Pool
on an instance of a language-defined generic unit is implementation-defined.
For nonderived access
types declared in places where the default pool is defined by the pragma
or aspect, their Storage_Pool or Storage_Size attribute is determined
as follows, unless Storage_Pool or Storage_Size is specified for the
type:
If the default pool is
null, the Storage_Size
attribute is defined by the language to be zero. Therefore, an
allocator
for such a type is illegal.
If the default pool is neither null nor
Standard, the Storage_Pool attribute is that pool.
Otherwise (including when the default pool is specified
as Standard), the standard storage pool is used for the type as described
in
13.11.
This paragraph was
deleted.
Implementation Permissions
An object created by an
allocator
that is passed as the actual parameter to an access parameter may be
allocated on the stack, and automatically reclaimed, regardless of the
default pool.
NOTE Default_Storage_Pool can be
used with restrictions No_Coextensions and No_Access_Parameter_Allocators
(see
H.4) to ensure that all
allocators
use the default pool.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe