Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

13.7.1 The Package System.Storage_Elements

Static Semantics

1
The following language-defined library package exists: 
2/2
package System.Storage_Elements is
   pragma Pure(Storage_Elements);
3
   type Storage_Offset is range implementation-defined;
4
   subtype Storage_Count is Storage_Offset range 0..Storage_Offset'Last;
5
   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;
6
   -- Address Arithmetic:
7/3
   function "+"(Left : Address; Right : Storage_Offset) return Address
      with Convention => Intrinsic;
   function "+"(Left : Storage_Offset; Right : Address) return Address
      with Convention => Intrinsic;
   function "-"(Left : Address; Right : Storage_Offset) return Address
      with Convention => Intrinsic;
   function "-"(Left, Right : Address) return Storage_Offset
      with Convention => Intrinsic;
8/3
   function "mod"(Left : Address; Right : Storage_Offset)
      return Storage_Offset
         with Convention => Intrinsic;
9
   -- Conversion to/from integers:
10/3
   type Integer_Address is implementation-defined;
   function To_Address(Value : Integer_Address) return Address
      with Convention => Intrinsic;
   function To_Integer(Value : Address) return Integer_Address
      with Convention => Intrinsic;
11/3
end System.Storage_Elements;
12
Storage_Element represents a storage element. Storage_Offset represents an offset in storage elements. Storage_Count represents a number of storage elements. Storage_Array represents a contiguous sequence of storage elements. 
13
Integer_Address is a (signed or modular) integer subtype. To_Address and To_Integer convert back and forth between this type and Address. 

Implementation Requirements

14
Storage_Offset'Last shall be greater than or equal to Integer'Last or the largest possible storage offset, whichever is smaller. Storage_Offset'First shall be <= (–Storage_Offset'Last).
Paragraph 15 was deleted. 

Implementation Advice

16
Operations in System and its children should reflect the target environment semantics as closely as is reasonable. For example, on most machines, it makes sense for address arithmetic to “wrap around.” Operations that do not make sense should raise Program_Error. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe