Default Storage Pools
Author: JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor

Ada Reference Manual — Legal Information

# 13.11.3 Default Storage Pools

1/3
This paragraph was deleted.

#### 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/3
storage_pool_indicator ::= storage_pool_ name | null
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/3
If the pragma is used as a configuration pragma, the storage_pool_indicator shall be null, and it defines the default pool to be null 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 either null or the pool denoted by the storage_pool_ name, except within the immediate scope of a later pragma Default_Storage_Pool. Thus, an inner pragma overrides an outer one.
4.2/3
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/3
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 expected type for the Default_Storage_Pool aspect is Root_Storage_Pool'Class. The aspect_definition must be a name that denotes a variable. This aspect overrides any Default_Storage_Pool pragma that might apply to the generic unit; if the aspect is not specified, the default pool of the instance is that defined for the generic unit.
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/3
If the default pool is nonnull, the Storage_Pool attribute is that pool.
6.3/3
Otherwise, there is no default pool; 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..
NOTES
9/3
32 Default_Storage_Pool may 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