Go to the first, previous, next, last section, table of contents.


A.1 The Package Standard

  1. This clause outlines the specification of the package Standard containing all predefined identifiers in the language. The corresponding package body is not specified by the language.
  2. The operators that are predefined for the types declared in the package Standard are given in comments since they are implicitly declared. Italics are used for pseudo-names of anonymous types (such as root_real) and for undefined information (such as implementation-defined).

    Static Semantics

  3. The library package Standard has the following declaration:
  4. package Standard is
       pragma Pure(Standard);
    
  5.    type Boolean is (False, True);
    
  6.    --  The predefined relational operators
       --  for this type are as follows:
    
  7.    -- function "="   (Left, Right : Boolean) return Boolean;
       -- function "/="  (Left, Right : Boolean) return Boolean;
       -- function "<"   (Left, Right : Boolean) return Boolean;
       -- function "<="  (Left, Right : Boolean) return Boolean;
       -- function ">"   (Left, Right : Boolean) return Boolean;
       -- function ">="  (Left, Right : Boolean) return Boolean;
    
  8.    --  The predefined logical operators and the predefined
       --  logical negation operator are as follows:
    
  9.    --  function "and" (Left, Right : Boolean) return Boolean;
       --  function "or"  (Left, Right : Boolean) return Boolean;
       --  function "xor" (Left, Right : Boolean) return Boolean;
    
  10.    --  function "not" (Right : Boolean) return Boolean;
    
  11.    --  The integer type root_integer is predefined.
       --  The corresponding universal type is universal_integer.
    
  12.    type Integer is range implementation-defined;
    
  13.    subtype Natural  is Integer range 0 .. Integer'Last;
       subtype Positive is Integer range 1 .. Integer'Last;
    
  14.    --  The predefined operators for type Integer are as follows:
    
  15.    --  function "="  (Left, Right : Integer'Base) return Boolean;
       --  function "/=" (Left, Right : Integer'Base) return Boolean;
       --  function "<"  (Left, Right : Integer'Base) return Boolean;
       --  function "<=" (Left, Right : Integer'Base) return Boolean;
       --  function ">"  (Left, Right : Integer'Base) return Boolean;
       --  function ">=" (Left, Right : Integer'Base) return Boolean;
    
  16.    --  function "+"   (Right : Integer'Base) return Integer'Base;
       --  function "-"   (Right : Integer'Base) return Integer'Base;
       --  function "abs" (Right : Integer'Base) return Integer'Base;
    
  17.    --  function "+"   (Left, Right : Integer'Base)
       --    return Integer'Base;
       --  function "-"   (Left, Right : Integer'Base)
       --    return Integer'Base;
       --  function "*"   (Left, Right : Integer'Base)
       --    return Integer'Base;
       --  function "/"   (Left, Right : Integer'Base)
       --    return Integer'Base;
       --  function "rem" (Left, Right : Integer'Base)
       --    return Integer'Base;
       --  function "mod" (Left, Right : Integer'Base)
       --    return Integer'Base;
    
  18.    --  function "**"
         (Left  : Integer'Base;
          Right : Natural) return Integer'Base;
    
  19.    --  The specification of each operator for the type
       --  root_integer, or for any additional predefined integer
       --  type, is obtained by replacing Integer by the name of the type
       --  in the specification of the corresponding operator of the type
       --  Integer. The right operand of the exponentiation operator
       --  remains as subtype Natural.
    
  20.    --  The floating point type root_real is predefined.
       --  The corresponding universal type is universal_real.
    
  21.    type Float is digits implementation-defined;
    
  22.    --  The predefined operators for this type are as follows:
    
  23.    --  function "="   (Left, Right : Float) return Boolean;
       --  function "/="  (Left, Right : Float) return Boolean;
       --  function "<"   (Left, Right : Float) return Boolean;
       --  function "<="  (Left, Right : Float) return Boolean;
       --  function ">"   (Left, Right : Float) return Boolean;
       --  function ">="  (Left, Right : Float) return Boolean;
    
  24.    --  function "+"   (Right : Float) return Float;
       --  function "-"   (Right : Float) return Float;
       --  function "abs" (Right : Float) return Float;
    
  25.    --  function "+"   (Left, Right : Float) return Float;
       --  function "-"   (Left, Right : Float) return Float;
       --  function "*"   (Left, Right : Float) return Float;
       --  function "/"   (Left, Right : Float) return Float;
    
  26.    --  function "**"
         (Left  : Float;
          Right : Integer'Base) return Float;
    
  27.    --  The specification of each operator for the type root_real,
       --  or  for any additional predefined floating point type, is
       --  obtained by replacing Float by the name of the type in the
       --  specification of the corresponding operator of the type Float.
    
  28.    --  In addition, the following operators are predefined for
       --  the root numeric types:
    
  29.    function "*" (Left : root_integer; Right : root_real)
         return root_real;
    
  30.    function "*" (Left : root_real; Right : root_integer)
         return root_real;
    
  31.    function "/" (Left : root_real; Right : root_integer)
         return root_real;
    
  32.    --  The type universal_fixed is predefined.
       --  The only multiplying operators defined between
       --  fixed point types are
    
  33.    function "*" (Left : universal_fixed; Right : universal_fixed)
         return universal_fixed;
    
  34.    function "/" (Left : universal_fixed; Right : universal_fixed)
         return universal_fixed;
    
       --  The declaration of type Character is based on the standard
       --  ISO 8859-1 character set.
    
  35.    --  There are no character literals corresponding to the
       --  positions for control characters. They are indicated in
       --  italics in this definition. See section 3.5.2 Character Types.
    
       type Character is
    
         (nul,  soh,  stx,  etx, eot,  enq,  ack,  bel,
          bs,   ht,   lf,   vt,  ff,   cr,   so,   si,
    
          dle,  dc1,  dc2,  dc3, dc4,  nak,  syn,  etb,
          can,  em,   sub,  esc, fs,   gs,   rs,   us,
    
          ' ',  '!',  '"',  '#', '$',  '%',  '&',  ''',
          '(',  ')',  '*',  '+', ',',  '-',  '.',  '/',
    
          '0',  '1',  '2',  '3', '4',  '5',  '6',  '7',
          '8',  '9',  ':',  ';', '<',  '=',  '>',  '?',
    
          '',  'A',  'B',  'C', 'D',  'E',  'F',  'G',
          'H',  'I',  'J',  'K', 'L',  'M',  'N',  'O',
    
          'P',  'Q',  'R',  'S', 'T',  'U',  'V',  'W',
          'X',  'Y',  'Z',  '[', '\',  ']',  '^',  '_',
    
          '`',  'a',  'b',  'c', 'd',  'e',  'f',  'g',
          'h',  'i',  'j',  'k', 'l',  'm',  'n',  'o',
    
          'p',  'q',  'r',  's', 't',  'u',  'v',  'w',
          'x',  'y',  'z',  '{', '|',  '}',  '~',  del,
    
          reserved_128, reserved_129,  bph,  nbh,
          reserved_132, nel,     ssa,  esa,
    
          hts, htj, vts, pld, plu, ri, ss2, ss3,
    
          dcs, pu1, pu2, sts, cch, mw, spa, epa,
    
          sos, reserved_153, sci, csi,
          st,  osc,          pm,  apc,
    
       ... );
    
  36.    --  The predefined operators for the type Character are the
       --  same as for any enumeration type.
    
       --  The declaration of type Wide_Character is based on the
       --  standard ISO 10646 BMP character set. The first 256 positions
       --  have the same contents as type Character. See section 3.5.2 Character Types.
    
       type Wide_Character is (nul, soh ... FFFE, FFFF);
    
       package ASCII is ... end ASCII;  --Obsolescent; See section J.5 ASCII.
    
       -- Predefined string types:
    
  37.    type String is array(Positive range <>) of Character;
       pragma Pack(String);
    
  38.    -- The predefined operators for this type are as follows:
    
  39.    --  function "="  (Left, Right: String) return Boolean;
       --  function "/=" (Left, Right: String) return Boolean;
       --  function "<"  (Left, Right: String) return Boolean;
       --  function "<=" (Left, Right: String) return Boolean;
       --  function ">"  (Left, Right: String) return Boolean;
       --  function ">=" (Left, Right: String) return Boolean;
    
  40.    --  function "&" (Left: String;    Right: String)
       --    return String;
       --  function "&" (Left: Character; Right: String)
       --    return String;
       --  function "&" (Left: String;    Right: Character)
       --    return String;
       --  function "&" (Left: Character; Right: Character)
       --    return String;
    
  41.    type Wide_String is array(Positive range <>) of Wide_Character;
       pragma Pack(Wide_String);
    
  42.    --  The predefined operators for this type correspond to those
       --  for String
    
  43.    type Duration is delta
         implementation-defined range implementation-defined;
    
  44.    --  The predefined operators for the type Duration are the
       --  same as for any fixed point type.
    
  45.    -- The predefined exceptions:
    
  46.    Constraint_Error: exception;
       Program_Error   : exception;
       Storage_Error   : exception;
       Tasking_Error   : exception;
    
  47. end Standard;
    
  48. Standard has no private part.
  49. In each of the types Character and Wide_Character, the character literals for the space character (position 32) and the non-breaking space character (position 160) correspond to different values. Unless indicated otherwise, each occurrence of the character literal ' ' in this International Standard refers to the space character. Similarly, the character literals for hyphen (position 45) and soft hyphen (position 173) correspond to different values. Unless indicated otherwise, each occurrence of the character literal '-' in this International Standard refers to the hyphen character.

    Dynamic Semantics

  50. Elaboration of the body of Standard has no effect.

    Implementation Permissions

  51. An implementation may provide additional predefined integer types and additional predefined floating point types. Not all of these types need have names.

    Implementation Advice

  52. If an implementation provides additional named predefined integer types, then the names should end with "Integer" as in "Long_Integer". If an implementation provides additional named predefined floating point types, then the names should end with "Float" as in "Long_Float".

    NOTES

  53. (1) Certain aspects of the predefined entities cannot be completely described in the language itself. For example, although the enumeration type Boolean can be written showing the two enumeration literals False and True, the short-circuit control forms cannot be expressed in the language.
  54. (2) As explained in See section 8.1 Declarative Region, and See section 10.1.4 The Compilation Process, the declarative region of the package Standard encloses every library unit and consequently the main subprogram; the declaration of every library unit is assumed to occur within this declarative region. Library_items are assumed to be ordered in such a way that there are no forward semantic dependences. However, as explained in See section 8.3 Visibility, the only library units that are visible within a given compilation unit are the library units named by all with_clauses that apply to the given unit, and moreover, within the declarative region of a given library unit, that library unit itself.
  55. (3) If all block_statements of a program are named, then the name of each program unit can always be written as an expanded name starting with Standard (unless Standard is itself hidden). The name of a library unit cannot be a homograph of a name (such as Integer) that is already declared in Standard.
  56. (4) The exception Standard.Numeric_Error is defined in See section J.6 Numeric_Error.


Go to the first, previous, next, last section, table of contents.