[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Implementation Defined Attributes

Ada defines (throughout the Ada reference manual, summarized in Annex K), a set of attributes that provide useful additional functionality in all areas of the language. These language defined attributes are implemented in GNAT and work as described in the Ada Reference Manual.

In addition, Ada allows implementations to define additional attributes whose meaning is defined by the implementation. GNAT provides a number of these implementation-dependent attributes which can be used to extend and enhance the functionality of the compiler. This section of the GNAT reference manual describes these additional attributes.

Note that any program using these attributes may not be portable to other compilers (although GNAT implements this set of attributes on all platforms). Therefore if portability to other compilers is an important consideration, you should minimize the use of these attributes.

Abort_Signal  
Address_Size  
Asm_Input  
Asm_Output  
AST_Entry  
Bit  
Bit_Position  
Compiler_Version  
Code_Address  
Default_Bit_Order  
Descriptor_Size  
Elaborated  
Elab_Body  
Elab_Spec  
Elab_Subp_Body  
Emax  
Enabled  
Enum_Rep  
Enum_Val  
Epsilon  
Fixed_Value  
Has_Access_Values  
Has_Discriminants  
Img  
Integer_Value  
Invalid_Value  
Large  
Machine_Size  
Mantissa  
Max_Interrupt_Priority  
Max_Priority  
Maximum_Alignment  
Mechanism_Code  
Null_Parameter  
Object_Size  
Old  
Passed_By_Reference  
Pool_Address  
Range_Length  
Ref  
Result  
Safe_Emax  
Safe_Large  
Scalar_Storage_Order  
Simple_Storage_Pool  
Small  
Storage_Unit  
Stub_Type  
System_Allocator_Alignment  
Target_Name  
Tick  
To_Address  
Type_Class  
UET_Address  
Unconstrained_Array  
Universal_Literal_String  
Unrestricted_Access  
Valid_Scalars  
VADS_Size  
Value_Size  
Wchar_T_Size  
Word_Size  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Abort_Signal

Standard'Abort_Signal (Standard is the only allowed prefix) provides the entity for the special exception used to signal task abort or asynchronous transfer of control. Normally this attribute should only be used in the tasking runtime (it is highly peculiar, and completely outside the normal semantics of Ada, for a user program to intercept the abort exception).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Address_Size

Standard'Address_Size (Standard is the only allowed prefix) is a static constant giving the number of bits in an Address. It is the same value as System.Address'Size, but has the advantage of being static, while a direct reference to System.Address'Size is non-static because Address is a private type.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Asm_Input

The Asm_Input attribute denotes a function that takes two parameters. The first is a string, the second is an expression of the type designated by the prefix. The first (string) argument is required to be a static expression, and is the constraint for the parameter, (e.g. what kind of register is required). The second argument is the value to be used as the input argument. The possible values for the constant are the same as those used in the RTL, and are dependent on the configuration file used to built the GCC back end. 13.1 Machine Code Insertions


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Asm_Output

The Asm_Output attribute denotes a function that takes two parameters. The first is a string, the second is the name of a variable of the type designated by the attribute prefix. The first (string) argument is required to be a static expression and designates the constraint for the parameter (e.g. what kind of register is required). The second argument is the variable to be updated with the result. The possible values for constraint are the same as those used in the RTL, and are dependent on the configuration file used to build the GCC back end. If there are no output operands, then this argument may either be omitted, or explicitly given as No_Output_Operands. 13.1 Machine Code Insertions


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

AST_Entry

This attribute is implemented only in OpenVMS versions of GNAT. Applied to the name of an entry, it yields a value of the predefined type AST_Handler (declared in the predefined package System, as extended by the use of pragma Extend_System (Aux_DEC)). This value enables the given entry to be called when an AST occurs. For further details, refer to the DEC Ada Language Reference Manual, section 9.12a.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Bit

obj'Bit, where obj is any object, yields the bit offset within the storage unit (byte) that contains the first bit of storage allocated for the object. The value of this attribute is of the type Universal_Integer, and is always a non-negative number not exceeding the value of System.Storage_Unit.

For an object that is a variable or a constant allocated in a register, the value is zero. (The use of this attribute does not force the allocation of a variable to memory).

For an object that is a formal parameter, this attribute applies to either the matching actual parameter or to a copy of the matching actual parameter.

For an access object the value is zero. Note that obj.all'Bit is subject to an Access_Check for the designated object. Similarly for a record component X.C'Bit is subject to a discriminant check and X(I).Bit and X(I1..I2)'Bit are subject to index checks.

This attribute is designed to be compatible with the DEC Ada 83 definition and implementation of the Bit attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Bit_Position

R.C'Bit_Position, where R is a record object and C is one of the fields of the record type, yields the bit offset within the record contains the first bit of storage allocated for the object. The value of this attribute is of the type Universal_Integer. The value depends only on the field C and is independent of the alignment of the containing record R.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Compiler_Version

Standard'Compiler_Version (Standard is the only allowed prefix) yields a static string identifying the version of the compiler being used to compile the unit containing the attribute reference. A typical result would be something like "GNAT 2012 (20090221)".


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Code_Address

The 'Address attribute may be applied to subprograms in Ada 95 and Ada 2005, but the intended effect seems to be to provide an address value which can be used to call the subprogram by means of an address clause as in the following example:

 
procedure K is ...

procedure L;
for L'Address use K'Address;
pragma Import (Ada, L);

A call to L is then expected to result in a call to K. In Ada 83, where there were no access-to-subprogram values, this was a common work-around for getting the effect of an indirect call. GNAT implements the above use of Address and the technique illustrated by the example code works correctly.

However, for some purposes, it is useful to have the address of the start of the generated code for the subprogram. On some architectures, this is not necessarily the same as the Address value described above. For example, the Address value may reference a subprogram descriptor rather than the subprogram itself.

The 'Code_Address attribute, which can only be applied to subprogram entities, always returns the address of the start of the generated code of the specified subprogram, which may or may not be the same value as is returned by the corresponding 'Address attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Default_Bit_Order

Standard'Default_Bit_Order (Standard is the only permissible prefix), provides the value System.Default_Bit_Order as a Pos value (0 for High_Order_First, 1 for Low_Order_First). This is used to construct the definition of Default_Bit_Order in package System.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Descriptor_Size

Non-static attribute Descriptor_Size returns the size in bits of the descriptor allocated for a type. The result is non-zero only for unconstrained array types and the returned value is of type universal integer. In GNAT, an array descriptor contains bounds information and is located immediately before the first element of the array.

 
type Unconstr_Array is array (Positive range <>) of Boolean;
Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);

The attribute takes into account any additional padding due to type alignment. In the example above, the descriptor contains two values of type Positive representing the low and high bound. Since Positive has a size of 31 bits and an alignment of 4, the descriptor size is 2 * Positive'Size + 2 or 64 bits.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Elaborated

The prefix of the 'Elaborated attribute must be a unit name. The value is a Boolean which indicates whether or not the given unit has been elaborated. This attribute is primarily intended for internal use by the generated code for dynamic elaboration checking, but it can also be used in user programs. The value will always be True once elaboration of all units has been completed. An exception is for units which need no elaboration, the value is always False for such units.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Elab_Body

This attribute can only be applied to a program unit name. It returns the entity for the corresponding elaboration procedure for elaborating the body of the referenced unit. This is used in the main generated elaboration procedure by the binder and is not normally used in any other context. However, there may be specialized situations in which it is useful to be able to call this elaboration procedure from Ada code, e.g. if it is necessary to do selective re-elaboration to fix some error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Elab_Spec

This attribute can only be applied to a program unit name. It returns the entity for the corresponding elaboration procedure for elaborating the spec of the referenced unit. This is used in the main generated elaboration procedure by the binder and is not normally used in any other context. However, there may be specialized situations in which it is useful to be able to call this elaboration procedure from Ada code, e.g. if it is necessary to do selective re-elaboration to fix some error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Elab_Subp_Body

This attribute can only be applied to a library level subprogram name and is only allowed in CodePeer mode. It returns the entity for the corresponding elaboration procedure for elaborating the body of the referenced subprogram unit. This is used in the main generated elaboration procedure by the binder in CodePeer mode only and is unrecognized otherwise.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Emax

The Emax attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Enabled

The Enabled attribute allows an application program to check at compile time to see if the designated check is currently enabled. The prefix is a simple identifier, referencing any predefined check name (other than All_Checks) or a check name introduced by pragma Check_Name. If no argument is given for the attribute, the check is for the general state of the check, if an argument is given, then it is an entity name, and the check indicates whether an Suppress or Unsuppress has been given naming the entity (if not, then the argument is ignored).

Note that instantiations inherit the check status at the point of the instantiation, so a useful idiom is to have a library package that introduces a check name with pragma Check_Name, and then contains generic packages or subprograms which use the Enabled attribute to see if the check is enabled. A user of this package can then issue a pragma Suppress or pragma Unsuppress before instantiating the package or subprogram, controlling whether the check will be present.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Enum_Rep

For every enumeration subtype S, S'Enum_Rep denotes a function with the following spec:

 
function S'Enum_Rep (Arg : S'Base)
  return Universal_Integer;

It is also allowable to apply Enum_Rep directly to an object of an enumeration type or to a non-overloaded enumeration literal. In this case S'Enum_Rep is equivalent to typ'Enum_Rep(S) where typ is the type of the enumeration literal or object.

The function returns the representation value for the given enumeration value. This will be equal to value of the Pos attribute in the absence of an enumeration representation clause. This is a static attribute (i.e. the result is static if the argument is static).

S'Enum_Rep can also be used with integer types and objects, in which case it simply returns the integer value. The reason for this is to allow it to be used for (<>) discrete formal arguments in a generic unit that can be instantiated with either enumeration types or integer types. Note that if Enum_Rep is used on a modular type whose upper bound exceeds the upper bound of the largest signed integer type, and the argument is a variable, so that the universal integer calculation is done at run time, then the call to Enum_Rep may raise Constraint_Error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Enum_Val

For every enumeration subtype S, S'Enum_Val denotes a function with the following spec:

 
function S'Enum_Val (Arg : Universal_Integer)
  return S'Base;

The function returns the enumeration value whose representation matches the argument, or raises Constraint_Error if no enumeration literal of the type has the matching value. This will be equal to value of the Val attribute in the absence of an enumeration representation clause. This is a static attribute (i.e. the result is static if the argument is static).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Epsilon

The Epsilon attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Fixed_Value

For every fixed-point type S, S'Fixed_Value denotes a function with the following specification:

 
function S'Fixed_Value (Arg : Universal_Integer)
  return S;

The value returned is the fixed-point value V such that

 
V = Arg * S'Small

The effect is thus similar to first converting the argument to the integer type used to represent S, and then doing an unchecked conversion to the fixed-point type. The difference is that there are full range checks, to ensure that the result is in range. This attribute is primarily intended for use in implementation of the input-output functions for fixed-point values.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Has_Access_Values

The prefix of the Has_Access_Values attribute is a type. The result is a Boolean value which is True if the is an access type, or is a composite type with a component (at any nesting depth) that is an access type, and is False otherwise. The intended use of this attribute is in conjunction with generic definitions. If the attribute is applied to a generic private type, it indicates whether or not the corresponding actual type has access values.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Has_Discriminants

The prefix of the Has_Discriminants attribute is a type. The result is a Boolean value which is True if the type has discriminants, and False otherwise. The intended use of this attribute is in conjunction with generic definitions. If the attribute is applied to a generic private type, it indicates whether or not the corresponding actual type has discriminants.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Img

The Img attribute differs from Image in that it may be applied to objects as well as types, in which case it gives the Image for the subtype of the object. This is convenient for debugging:

 
Put_Line ("X = " & X'Img);

has the same meaning as the more verbose:

 
Put_Line ("X = " & T'Image (X));

where T is the (sub)type of the object X.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Integer_Value

For every integer type S, S'Integer_Value denotes a function with the following spec:

 
function S'Integer_Value (Arg : Universal_Fixed)
  return S;

The value returned is the integer value V, such that

 
Arg = V * T'Small

where T is the type of Arg. The effect is thus similar to first doing an unchecked conversion from the fixed-point type to its corresponding implementation type, and then converting the result to the target integer type. The difference is that there are full range checks, to ensure that the result is in range. This attribute is primarily intended for use in implementation of the standard input-output functions for fixed-point values.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Invalid_Value

For every scalar type S, S'Invalid_Value returns an undefined value of the type. If possible this value is an invalid representation for the type. The value returned is identical to the value used to initialize an otherwise uninitialized value of the type if pragma Initialize_Scalars is used, including the ability to modify the value with the binder -Sxx flag and relevant environment variables at run time.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Large

The Large attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Machine_Size

This attribute is identical to the Object_Size attribute. It is provided for compatibility with the DEC Ada 83 attribute of this name.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Mantissa

The Mantissa attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Max_Interrupt_Priority

Standard'Max_Interrupt_Priority (Standard is the only permissible prefix), provides the same value as System.Max_Interrupt_Priority.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Max_Priority

Standard'Max_Priority (Standard is the only permissible prefix) provides the same value as System.Max_Priority.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Maximum_Alignment

Standard'Maximum_Alignment (Standard is the only permissible prefix) provides the maximum useful alignment value for the target. This is a static value that can be used to specify the alignment for an object, guaranteeing that it is properly aligned in all cases.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Mechanism_Code

function'Mechanism_Code yields an integer code for the mechanism used for the result of function, and subprogram'Mechanism_Code (n) yields the mechanism used for formal parameter number n (a static integer value with 1 meaning the first parameter) of subprogram. The code returned is:

1
by copy (value)
2
by reference
3
by descriptor (default descriptor class)
4
by descriptor (UBS: unaligned bit string)
5
by descriptor (UBSB: aligned bit string with arbitrary bounds)
6
by descriptor (UBA: unaligned bit array)
7
by descriptor (S: string, also scalar access type parameter)
8
by descriptor (SB: string with arbitrary bounds)
9
by descriptor (A: contiguous array)
10
by descriptor (NCA: non-contiguous array)

Values from 3 through 10 are only relevant to Digital OpenVMS implementations.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Null_Parameter

A reference T'Null_Parameter denotes an imaginary object of type or subtype T allocated at machine address zero. The attribute is allowed only as the default expression of a formal parameter, or as an actual expression of a subprogram call. In either case, the subprogram must be imported.

The identity of the object is represented by the address zero in the argument list, independent of the passing mechanism (explicit or default).

This capability is needed to specify that a zero address should be passed for a record or other composite object passed by reference. There is no way of indicating this without the Null_Parameter attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Object_Size

The size of an object is not necessarily the same as the size of the type of an object. This is because by default object sizes are increased to be a multiple of the alignment of the object. For example, Natural'Size is 31, but by default objects of type Natural will have a size of 32 bits. Similarly, a record containing an integer and a character:

 
type Rec is record
   I : Integer;
   C : Character;
end record;

will have a size of 40 (that is Rec'Size will be 40). The alignment will be 4, because of the integer field, and so the default size of record objects for this type will be 64 (8 bytes).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Old

The attribute Prefix'Old can be used within a subprogram body or within a precondition or postcondition pragma. The effect is to refer to the value of the prefix on entry. So for example if you have an argument of a record type X called Arg1, you can refer to Arg1.Field'Old which yields the value of Arg1.Field on entry. The implementation simply involves generating an object declaration which captures the value on entry. The prefix must denote an object of a nonlimited type (since limited types cannot be copied to capture their values) and it must not reference a local variable (since local variables do not exist at subprogram entry time). Note that the variable introduced by a quantified expression is a local variable. The following example shows the use of 'Old to implement a test of a postcondition:

 
with Old_Pkg;
procedure Old is
begin
   Old_Pkg.Incr;
end Old;

package Old_Pkg is
   procedure Incr;
end Old_Pkg;

package body Old_Pkg is
   Count : Natural := 0;

   procedure Incr is
   begin
      ... code manipulating the value of Count

      pragma Assert (Count = Count'Old + 1);
   end Incr;
end Old_Pkg;

Note that it is allowed to apply 'Old to a constant entity, but this will result in a warning, since the old and new values will always be the same.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Passed_By_Reference

type'Passed_By_Reference for any subtype type returns a value of type Boolean value that is True if the type is normally passed by reference and False if the type is normally passed by copy in calls. For scalar types, the result is always False and is static. For non-scalar types, the result is non-static.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Pool_Address

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Range_Length

type'Range_Length for any discrete type type yields the number of values represented by the subtype (zero for a null range). The result is static for static subtypes. Range_Length applied to the index subtype of a one dimensional array always gives the same result as Range applied to the array itself.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Ref

The System.Address'Ref (System.Address is the only permissible prefix) denotes a function identical to System.Storage_Elements.To_Address except that it is a static attribute. See To_Address for more details.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Result

function'Result can only be used with in a Postcondition pragma for a function. The prefix must be the name of the corresponding function. This is used to refer to the result of the function in the postcondition expression. For a further discussion of the use of this attribute and examples of its use, see the description of pragma Postcondition.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Safe_Emax

The Safe_Emax attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Safe_Large

The Safe_Large attribute is provided for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Scalar_Storage_Order

For every record subtype S, the representation attribute Scalar_Storage_Order denotes the order in which storage elements that make up scalar components are ordered within S. Other properties are as for standard representation attribute Bit_Order, as defined by Ada RM 13.5.3(4). The default is System.Default_Bit_Order.

If S'Scalar_Storage_Order is specified explicitly, it shall be equal to S'Bit_Order. Note: This means that if a Scalar_Storage_Order attribute definition clause is not confirming, then the type's Bit_Order shall be specified explicitly and set to the same value.

A confirming Scalar_Storage_Order attribute definition clause (i.e. with a value equal to System.Default_Bit_Order) has no effect.

If the opposite storage order is specified, then whenever the value of a scalar component of S is read, the storage elements of the enclosing machine scalar are first reversed (before retrieving the component value, possibly applying some shift and mask operatings on the enclosing machine scalar), and the opposite operation is done for writes.

In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components are relaxed. Instead, the following rules apply:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Simple_Storage_Pool

For every nonformal, nonderived access-to-object type Acc, the representation attribute Simple_Storage_Pool may be specified via an attribute_definition_clause (or by specifying the equivalent aspect):

 
My_Pool : My_Simple_Storage_Pool_Type;

type Acc is access My_Data_Type;

for Acc'Simple_Storage_Pool use My_Pool;

The name given in an attribute_definition_clause for the Simple_Storage_Pool attribute shall denote a variable of a "simple storage pool type" (see pragma Simple_Storage_Pool_Type).

The use of this attribute is only allowed for a prefix denoting a type for which it has been specified. The type of the attribute is the type of the variable specified as the simple storage pool of the access type, and the attribute denotes that variable.

It is illegal to specify both Storage_Pool and Simple_Storage_Pool for the same access type.

If the Simple_Storage_Pool attribute has been specified for an access type, then applying the Storage_Pool attribute to the type is flagged with a warning and its evaluation raises the exception Program_Error.

If the Simple_Storage_Pool attribute has been specified for an access type S, then the evaluation of the attribute S'Storage_Size returns the result of calling Storage_Size (S'Simple_Storage_Pool), which is intended to indicate the number of storage elements reserved for the simple storage pool. If the Storage_Size function has not been defined for the simple storage pool type, then this attribute returns zero.

If an access type S has a specified simple storage pool of type SSP, then the evaluation of an allocator for that access type calls the primitive Allocate procedure for type SSP, passing S'Simple_Storage_Pool as the pool parameter. The detailed semantics of such allocators is the same as those defined for allocators in section 13.11 of the Ada Reference Manual, with the term "simple storage pool" substituted for "storage pool".

If an access type S has a specified simple storage pool of type SSP, then a call to an instance of the Ada.Unchecked_Deallocation for that access type invokes the primitive Deallocate procedure for type SSP, passing S'Simple_Storage_Pool as the pool parameter. The detailed semantics of such unchecked deallocations is the same as defined in section 13.11.2 of the Ada Reference Manual, except that the term "simple storage pool" is substituted for "storage pool".


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Small

The Small attribute is defined in Ada 95 (and Ada 2005) only for fixed-point types. GNAT also allows this attribute to be applied to floating-point types for compatibility with Ada 83. See the Ada 83 reference manual for an exact description of the semantics of this attribute when applied to floating-point types.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Storage_Unit

Standard'Storage_Unit (Standard is the only permissible prefix) provides the same value as System.Storage_Unit.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Stub_Type

The GNAT implementation of remote access-to-classwide types is organized as described in AARM section E.4 (20.t): a value of an RACW type (designating a remote object) is represented as a normal access value, pointing to a "stub" object which in turn contains the necessary information to contact the designated remote object. A call on any dispatching operation of such a stub object does the remote call, if necessary, using the information in the stub object to locate the target partition, etc.

For a prefix T that denotes a remote access-to-classwide type, T'Stub_Type denotes the type of the corresponding stub objects.

By construction, the layout of T'Stub_Type is identical to that of type RACW_Stub_Type declared in the internal implementation-defined unit System.Partition_Interface. Use of this attribute will create an implicit dependency on this unit.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

System_Allocator_Alignment

Standard'System_Allocator_Alignment (Standard is the only permissible prefix) provides the observable guaranted to be honored by the system allocator (malloc). This is a static value that can be used in user storage pools based on malloc either to reject allocation with alignment too large or to enable a realignment circuitry if the alignment request is larger than this value.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Target_Name

Standard'Target_Name (Standard is the only permissible prefix) provides a static string value that identifies the target for the current compilation. For GCC implementations, this is the standard gcc target name without the terminating slash (for example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Tick

Standard'Tick (Standard is the only permissible prefix) provides the same value as System.Tick,


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

To_Address

The System'To_Address (System is the only permissible prefix) denotes a function identical to System.Storage_Elements.To_Address except that it is a static attribute. This means that if its argument is a static expression, then the result of the attribute is a static expression. The result is that such an expression can be used in contexts (e.g. preelaborable packages) which require a static expression and where the function call could not be used (since the function call is always non-static, even if its argument is static).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Type_Class

type'Type_Class for any type or subtype type yields the value of the type class for the full type of type. If type is a generic formal type, the value is the value for the corresponding actual subtype. The value of this attribute is of type System.Aux_DEC.Type_Class, which has the following definition:

 
  type Type_Class is
    (Type_Class_Enumeration,
     Type_Class_Integer,
     Type_Class_Fixed_Point,
     Type_Class_Floating_Point,
     Type_Class_Array,
     Type_Class_Record,
     Type_Class_Access,
     Type_Class_Task,
     Type_Class_Address);

Protected types yield the value Type_Class_Task, which thus applies to all concurrent types. This attribute is designed to be compatible with the DEC Ada 83 attribute of the same name.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

UET_Address

The UET_Address attribute can only be used for a prefix which denotes a library package. It yields the address of the unit exception table when zero cost exception handling is used. This attribute is intended only for use within the GNAT implementation. See the unit Ada.Exceptions in files `a-except.ads' and `a-except.adb' for details on how this attribute is used in the implementation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Unconstrained_Array

The Unconstrained_Array attribute can be used with a prefix that denotes any type or subtype. It is a static attribute that yields True if the prefix designates an unconstrained array, and False otherwise. In a generic instance, the result is still static, and yields the result of applying this test to the generic actual.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Universal_Literal_String

The prefix of Universal_Literal_String must be a named number. The static result is the string consisting of the characters of the number as defined in the original source. This allows the user program to access the actual text of named numbers without intermediate conversions and without the need to enclose the strings in quotes (which would preclude their use as numbers).

For example, the following program prints the first 50 digits of pi:

 
with Text_IO; use Text_IO;
with Ada.Numerics;
procedure Pi is
begin
   Put (Ada.Numerics.Pi'Universal_Literal_String);
end;


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Unrestricted_Access

The Unrestricted_Access attribute is similar to Access except that all accessibility and aliased view checks are omitted. This is a user-beware attribute. It is similar to Address, for which it is a desirable replacement where the value desired is an access type. In other words, its effect is identical to first applying the Address attribute and then doing an unchecked conversion to a desired access type. In GNAT, but not necessarily in other implementations, the use of static chains for inner level subprograms means that Unrestricted_Access applied to a subprogram yields a value that can be called as long as the subprogram is in scope (normal Ada accessibility rules restrict this usage).

It is possible to use Unrestricted_Access for any type, but care must be exercised if it is used to create pointers to unconstrained objects. In this case, the resulting pointer has the same scope as the context of the attribute, and may not be returned to some enclosing scope. For instance, a function cannot use Unrestricted_Access to create a unconstrained pointer and then return that value to the caller.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Valid_Scalars

The 'Valid_Scalars attribute is intended to make it easier to check the validity of scalar subcomponents of composite objects. It is defined for any prefix X that denotes an object. The value of this attribute is of the predefined type Boolean. X'Valid_Scalars yields True if and only if evaluation of P'Valid yields True for every scalar part P of X or if X has no scalar parts. It is not specified in what order the scalar parts are checked, nor whether any more are checked after any one of them is determined to be invalid. If the prefix X is of a class-wide type T'Class (where T is the associated specific type), or if the prefix X is of a specific tagged type T, then only the scalar parts of components of T are traversed; in other words, components of extensions of T are not traversed even if T'Class (X)'Tag /= T'Tag . The compiler will issue a warning if it can be determined at compile time that the prefix of the attribute has no scalar parts (e.g., if the prefix is of an access type, an interface type, an undiscriminated task type, or an undiscriminated protected type).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

VADS_Size

The 'VADS_Size attribute is intended to make it easier to port legacy code which relies on the semantics of 'Size as implemented by the VADS Ada 83 compiler. GNAT makes a best effort at duplicating the same semantic interpretation. In particular, 'VADS_Size applied to a predefined or other primitive type with no Size clause yields the Object_Size (for example, Natural'Size is 32 rather than 31 on typical machines). In addition 'VADS_Size applied to an object gives the result that would be obtained by applying the attribute to the corresponding type.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Value_Size

type'Value_Size is the number of bits required to represent a value of the given subtype. It is the same as type'Size, but, unlike Size, may be set for non-first subtypes.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Wchar_T_Size

Standard'Wchar_T_Size (Standard is the only permissible prefix) provides the size in bits of the C wchar_t type primarily for constructing the definition of this type in package Interfaces.C.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Word_Size

Standard'Word_Size (Standard is the only permissible prefix) provides the value System.Word_Size.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by GNAT Mailserver on May, 10 2012 using texi2html