Ada Reference Manual (Ada 2022) — Legal Information

# 13.11.3 Default Storage Pools

1/4
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

2/3
The form of a pragma Default_Storage_Pool is as follows:
3/3
pragma Default_Storage_Pool (storage_pool_indicator);
3.1/4
storage_pool_indicator ::= storage_pool_name | null | Standard
3.2/3
A pragma Default_Storage_Pool is allowed immediately within the visible part of a package_specification, immediately within a declarative_part, or as a configuration pragma.

#### Name Resolution Rules

3.3/3
The storage_pool_name is expected to be of type Root_Storage_Pool'Class.

#### Legality Rules

4/3
The storage_pool_name shall denote a variable.
4.1/4
The Standard storage_pool_indicator is an identifier specific to a pragma (see 2.8) and does not denote any declaration. If the storage_pool_indicator is Standard, then there shall not be a declaration with defining_identifier Standard that is immediately visible at the point of the pragma, other than package Standard itself.
4.2/4
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.
4.3/4
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

5/4
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. .
5.1/4
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.
5.2/5
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.
5.3/4
The effect of specifying the aspect Default_Storage_Pool on an instance of a language-defined generic unit is implementation-defined.
6/3
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:
6.1/3
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.
6.2/4
If the default pool is neither null nor Standard, the Storage_Pool attribute is that pool.
6.3/4
Otherwise (including when the default pool is specified as Standard), the standard storage pool is used for the type as described in 13.11.
7/3
This paragraph was deleted.

#### Implementation Permissions

8/3
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.
9/5
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