representation_clause ::= attribute_definition_clause | enumeration_representation_clause | record_representation_clause | at_clause
local_name ::= direct_name | direct_name'attribute_designator | library_unit_name
Name Resolution Rules
Dynamic Semantics
pragma Pack(first_subtype_local_name);Legality Rules
attribute_definition_clause ::= for local_name'attribute_designator use expression; | for local_name'attribute_designator use name;Name Resolution Rules
Denotes the address of the first of the storage elements allocated to X. For a program unit or label, this value refers to the machine code associated with the corresponding body or statement. The value of this attribute is of type System.Address.
Address may be specified for stand-alone objects and for program units via an attribute_definition_clause.Erroneous Execution
The Address of an object that is allocated under control of the implementation is an integral multiple of the Alignment of the object (that is, the Address modulo the Alignment is zero). The offset of a record component is a multiple of the Alignment of the component. For an object that is not allocated under control of the implementation (that is, one that is imported, that is allocated by a user-defined allocator, whose Address has been specified, or is designated by an access value returned by an instance of Unchecked_Conversion), the implementation may assume that the Address is an integral multiple of its Alignment. The implementation shall not assume a stricter alignment.
The value of this attribute is of type universal_integer, and nonnegative; zero means that the object is not necessarily aligned on a storage element boundary.
Alignment may be specified for first subtypes and stand-alone objects via an attribute_definition_clause; the expression of such a clause shall be static, and its value nonnegative. If the Alignment of a subtype is specified, then the Alignment of an object of the subtype is at least as strict, unless the object's Alignment is also specified. The Alignment of an object created by an allocator is that of the designated subtype.
If an Alignment is specified for a composite subtype or object, this Alignment shall be equal to the least common multiple of any specified Alignments of the subcomponent subtypes, or an integer multiple thereof.Erroneous Execution
Denotes the size in bits of the representation of the object. The value of this attribute is of the type universal_integer.
Implementation Advice
Static Semantics
If S is definite, denotes the size (in bits) that the implementation would choose for the following objects of subtype S:
Implementation Requirements
Denotes the number of storage elements reserved for the task. The value of this attribute is of the type universal_integer. The Storage_Size includes the size of the task's stack, if any. The language does not specify whether or not it includes other storage associated with the task (such as the ``task control block'' used by some implementations.) If a pragma Storage_Size is given, the value of the Storage_Size attribute is at least the value specified in the pragma.
pragma Storage_Size(expression);
Name Resolution Rules
Denotes the size in bits of components of the type of X. The value of this attribute is of type universal_integer.
Implementation Advice
Static Semantics
S'External_Tag denotes an external string representation for S'Tag; it is of the predefined type String. External_Tag may be specified for a specific tagged type via an attribute_definition_clause; the expression of such a clause shall be static. The default external tag representation is implementation defined. See section Dispatching Operations of Tagged Types, and See section Stream-Oriented Attributes.Implementation Requirements
Byte : constant := 8; Page : constant := 2**12;
type Medium is range 0 .. 65_000; for Medium'Size use 2*Byte; for Medium'Alignment use 2; Device_Register : Medium; for Device_Register'Size use Medium'Size; for Device_Register'Address use System.Storage_Elements.To_Address(16#FFFF_0020#);
type Short is delta 0.01 range -100.0 .. 100.0; for Short'Size use 15;
for Car_Name'Storage_Size use -- specify access type's storage pool size 2000*((Car'Size/System.Storage_Unit) +1); -- approximately 2000 cars
function My_Read(Stream : access Ada.Streams.Root_Stream_Type'Class) return T; for T'Read use My_Read; -- see section Stream-Oriented AttributesNOTES
enumeration_representation_clause ::= for first_subtype_local_name use enumeration_aggregate;
enumeration_aggregate ::= array_aggregateName Resolution Rules
type Mix_Code is (ADD, SUB, MUL, LDA, STA, STZ);
for Mix_Code use (ADD => 1, SUB => 2, MUL => 3, LDA => 8, STA => 24, STZ =>33);
record_representation_clause ::= for first_subtype_local_name use record [mod_clause] {component_clause} end record;
component_clause ::= component_local_name at position range first_bit .. last_bit;
position ::= static_expression
first_bit ::= static_simple_expression
last_bit ::= static_simple_expressionName Resolution Rules
Word : constant := 4; -- storage element is byte, 4 bytes per word
type State is (A,M,W,P); type Mode is (Fix, Dec, Exp, Signif);
type Byte_Mask is array (0..7) of Boolean; type State_Mask is array (State) of Boolean; type Mode_Mask is array (Mode) of Boolean;
type Program_Status_Word is record System_Mask : Byte_Mask; Protection_Key : Integer range 0 .. 3; Machine_State : State_Mask; Interrupt_Cause : Interruption_Code; Ilc : Integer range 0 .. 3; Cc : Integer range 0 .. 3; Program_Mask : Mode_Mask; Inst_Address : Address; end record;
for Program_Status_Word use record System_Mask at 0*Word range 0 .. 7; Protection_Key at 0*Word range 10 .. 11; -- bits 8,9 unused Machine_State at 0*Word range 12 .. 15; Interrupt_Cause at 0*Word range 16 .. 31; Ilc at 1*Word range 0 .. 1; -- second word Cc at 1*Word range 2 .. 3; Program_Mask at 1*Word range 4 .. 7; Inst_Address at 1*Word range 8 .. 31; end record;
for Program_Status_Word'Size use 8*System.Storage_Unit; for Program_Status_Word'Alignment use 8;NOTES
Static Semantics
Denotes the same value as R.C'Address - R'Address. The value of this attribute is of the type universal_integer.
Denotes the offset, from the start of the first of the storage elements occupied by C, of the first bit occupied by C. This offset is measured in bits. The first bit of a storage element is numbered zero. The value of this attribute is of the type universal_integer.
Denotes the offset, from the start of the first of the storage elements occupied by C, of the last bit occupied by C. This offset is measured in bits. The value of this attribute is of the type universal_integer.Implementation Advice
Denotes the bit ordering for the type of S. The value of this attribute is of type System.Bit_Order. Bit_Order may be specified for specific record types via an attribute_definition_clause; the expression of such a clause shall be static.
-- Packed_Descriptor and Descriptor are two different types -- with identical characteristics, apart from their -- representation
type Descriptor is record -- components of a descriptor end record;
type Packed_Descriptor is new Descriptor;
for Packed_Descriptor use record -- component clauses for some or for all components end record;
-- Change of representation can now be accomplished -- by explicit type conversions:
D : Descriptor; P : Packed_Descriptor;
P := Packed_Descriptor(D); -- pack D D := Descriptor(P); -- unpack P
package System is pragma Preelaborate(System);
type Name is implementation-defined-enumeration-type; System_Name : constant Name := implementation-defined;
-- System-Dependent Named Numbers:
Min_Int : constant := root_integer'First; Max_Int : constant := root_integer'Last;
Max_Binary_Modulus : constant := implementation-defined; Max_Nonbinary_Modulus : constant := implementation-defined;
Max_Base_Digits : constant := root_real'Digits; Max_Digits : constant := implementation-defined;
Max_Mantissa : constant := implementation-defined; Fine_Delta : constant := implementation-defined;
Tick : constant := implementation-defined;
-- Storage-related Declarations:
type Address is implementation-defined; Null_Address : constant Address;
Storage_Unit : constant := implementation-defined; Word_Size : constant := implementation-defined * Storage_Unit; Memory_Size : constant := implementation-defined;
-- Address Comparison: function "<" (Left, Right : Address) return Boolean; function "<="(Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">="(Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; -- function "/=" (Left, Right : Address) return Boolean; -- "/=" is implicitly defined pragma Convention(Intrinsic, "<"); ... -- and so on for all language-defined subprograms in this package
-- Other System-Dependent Declarations: type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order;
-- Priority-related declarations, see section Task Priorities.: subtype Any_Priority is Integer range implementation-defined; subtype Priority is Any_Priority range Any_Priority'First .. implementation-defined; subtype Interrupt_Priority is Any_Priority range Priority'Last+1 .. Any_Priority'Last;
Default_Priority : constant Priority := (Priority'First + Priority'Last)/2;
private ... -- not specified by the language end System;
The smallest (most negative) value allowed for the expressions of a signed_integer_type_definition.
The largest (most positive) value allowed for the expressions of a signed_integer_type_definition.
A power of two such that it, and all lesser positive powers of two, are allowed as the modulus of a modular_type_definition.
A value such that it, and all lesser positive integers, are allowed as the modulus of a modular_type_definition.
The largest value allowed for the requested decimal precision in a floating_point_definition.
The largest value allowed for the requested decimal precision in a floating_point_definition that has no real_range_specification. Max_Digits is less than or equal to Max_Base_Digits.
The largest possible number of binary digits in the mantissa of machine numbers of a user-defined ordinary fixed point type. (The mantissa is defined in Annex See section Numerics (normative).)
The smallest delta allowed in an ordinary_fixed_point_definition that has the real_range_specification range -1.0 .. 1.0.
A period in seconds approximating the real time interval during which the value of Calendar.Clock remains constant.
The number of bits per storage element.
The number of bits per word.
An implementation-defined value that is intended to reflect the memory size of the configuration in storage elements.
Static Semantics
package System.Storage_Elements is pragma Preelaborate(System.Storage_Elements);
type Storage_Offset is range implementation-defined;
subtype Storage_Count is Storage_Offset range 0..Storage_Offset'Last;
type Storage_Element is mod implementation-defined; for Storage_Element'Size use Storage_Unit; type Storage_Array is array (Storage_Offset range <>) of aliased Storage_Element; for Storage_Array'Component_Size use Storage_Unit;
-- Address Arithmetic:
function "+"(Left : Address; Right : Storage_Offset) return Address; function "+"(Left : Storage_Offset; Right : Address) return Address; function "-"(Left : Address; Right : Storage_Offset) return Address; function "-"(Left, Right : Address) return Storage_Offset;
function "mod"(Left : Address; Right : Storage_Offset) return Storage_Offset;
-- Conversion to/from integers:
type Integer_Address is implementation-defined; function To_Address(Value : Integer_Address) return Address; function To_Integer(Value : Address) return Integer_Address;
pragma Convention(Intrinsic, "+"); -- ...and so on for all language-defined subprograms -- declared in this package. end System.Storage_Elements;
Static Semantics
generic type Object(<>) is limited private; package System.Address_To_Access_Conversions is pragma Preelaborate(Address_To_Access_Conversions);
type Object_Pointer is access all Object; function To_Pointer(Value : Address) return Object_Pointer; function To_Address(Value : Object_Pointer) return Address;
pragma Convention(Intrinsic, To_Pointer); pragma Convention(Intrinsic, To_Address); end System.Address_To_Access_Conversions;
code_statement ::= qualified_expression;
Name Resolution Rules
M : Mask; procedure Set_Mask; pragma Inline(Set_Mask);
procedure Set_Mask is use System.Machine_Code; -- assume ``with System.Machine_Code;'' appears somewhere above begin SI_Format'(Code => SSM, B => M'Base_Reg, D => M'Disp); -- Base_Reg and Disp are implementation-defined attributes end Set_Mask;
generic type Source(<>) is limited private; type Target(<>) is limited private; function Ada.Unchecked_Conversion(S : Source) return Target; pragma Convention(Intrinsic, Ada.Unchecked_Conversion); pragma Pure(Ada.Unchecked_Conversion);Dynamic Semantics
Erroneous Execution
Yields True if and only if the object denoted by X is normal and has a valid representation. The value of this attribute is of the predefined type Boolean.NOTES
All rules and semantics that apply to X'Access, see section Operations of Access Types, apply also to X'Unchecked_Access, except that, for the purposes of accessibility rules and checks, it is as if X were declared immediately within a library package.NOTES
with Ada.Finalization; with System.Storage_Elements; package System.Storage_Pools is pragma Preelaborate(System.Storage_Pools);
type Root_Storage_Pool is abstract new Ada.Finalization.Limited_Controlled with private;
procedure Allocate( Pool : in out Root_Storage_Pool; Storage_Address : out Address; Size_In_Storage_Elements : in Storage_Elements.Storage_Count; Alignment : in Storage_Elements.Storage_Count) is abstract;
procedure Deallocate( Pool : in out Root_Storage_Pool; Storage_Address : in Address; Size_In_Storage_Elements : in Storage_Elements.Storage_Count; Alignment : in Storage_Elements.Storage_Count) is abstract;
function Storage_Size(Pool : Root_Storage_Pool) return Storage_Elements.Storage_Count is abstract;
private ... -- not specified by the language end System.Storage_Pools;
Denotes the storage pool of the type of S. The type of this attribute is Root_Storage_Pool'Class.
Yields the result of calling Storage_Size(S'Storage_Pool), which is intended to be a measure of the number of storage elements reserved for the pool. The type of this attribute is universal_integer.
Pool_Object : Some_Storage_Pool_Type;
type T is access Designated; for T'Storage_Pool use Pool_Object;
for T2'Storage_Pool use T'Storage_Pool;
type Mark_Release_Pool_Type (Pool_Size : Storage_Elements.Storage_Count; Block_Size : Storage_Elements.Storage_Count) is new Root_Storage_Pool with limited private;
...
MR_Pool : Mark_Release_Pool_Type (Pool_Size => 2000, Block_Size => 100);
type Acc is access ...; for Acc'Storage_Pool use MR_Pool; ...
Mark(MR_Pool); ... -- Allocate objects using ``new Designated(...)''. Release(MR_Pool); -- Reclaim the storage.
Denotes the maximum value for Size_In_Storage_Elements that will be requested via Allocate for an access type whose designated subtype is S. The value of this attribute is of type universal_integer.
generic type Object(<>) is limited private; type Name is access Object; procedure Ada.Unchecked_Deallocation(X : in out Name); pragma Convention(Intrinsic, Ada.Unchecked_Deallocation); pragma Preelaborate(Ada.Unchecked_Deallocation);Dynamic Semantics
procedure Free is new Ada.Unchecked_Deallocation (object_subtype_name, access_to_variable_subtype_name);
pragma Controlled(first_subtype_local_name);Legality Rules
pragma Restrictions(restriction{, restriction});
restriction ::= restriction_identifier | restriction_parameter_identifier => expressionName Resolution Rules
Static Semantics
package Ada.Streams is pragma Pure(Streams);
type Root_Stream_Type is abstract tagged limited private;
type Stream_Element is mod implementation-defined; type Stream_Element_Offset is range implementation-defined; subtype Stream_Element_Count is Stream_Element_Offset range 0..Stream_Element_Offset'Last; type Stream_Element_Array is array(Stream_Element_Offset range <>) of Stream_Element;
procedure Read( Stream : in out Root_Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is abstract;
procedure Write( Stream : in out Root_Stream_Type; Item : in Stream_Element_Array) is abstract;
private ... -- not specified by the language end Ada.Streams;
S'Write denotes a procedure with the following specification:
procedure S'Write( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in T)
S'Read denotes a procedure with the following specification:
procedure S'Read( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : out T)
S'Class'Write denotes a procedure with the following specification:
procedure S'Class'Write( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in T'Class)
S'Class'Read denotes a procedure with the following specification:
procedure S'Class'Read( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : out T'Class)
Implementation Advice
S'Output denotes a procedure with the following specification:
procedure S'Output( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in T)
S'Input denotes a function with the following specification:
function S'Input( Stream : access Ada.Streams.Root_Stream_Type'Class) return T
S'Class'Output denotes a procedure with the following specification:
procedure S'Class'Output( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in T'Class)
S'Class'Input denotes a function with the following specification:
function S'Class'Input( Stream : access Ada.Streams.Root_Stream_Type'Class) return T'Class
procedure My_Write (Stream : access Ada.Streams.Root_Stream_Type'Class; Item : My_Integer'Base); for My_Integer'Write use My_Write;
Legality Rules
Go to the first, previous, next, last section, table of contents.