-
For the third step above, the object creation and any elaborations and
evaluations are performed in an arbitrary order, except that if the
default_expression for a discriminant is evaluated to obtain its initial
value, then this evaluation is performed before that of the
default_expression for any component that depends on the discriminant,
and also before that of any default_expression that includes the name of
the discriminant. The evaluations of the third step and the assignments
of the fourth step are performed in an arbitrary order, except that each
evaluation is performed before the resulting value is assigned.
-
There is no implicit initial value defined for a scalar subtype. In the
absence of an explicit initialization, a newly created scalar object
might have a value that does not belong to its subtype See section 13.9.1 Data Validity,
and See section H.1 Pragma Normalize_Scalars.
NOTES
-
(7) Implicit initial values are not defined for an indefinite subtype,
because if an object's nominal subtype is indefinite, an explicit
initial value is required.
-
(8) As indicated above, a stand-alone object is an object declared by an
object_declaration. Similar definitions apply to "stand-alone
constant" and "stand-alone variable." A subcomponent of an object is
not a stand-alone object, nor is an object that is created by an
allocator. An object declared by a loop_parameter_specification,
parameter_specification, entry_index_specification,
choice_parameter_specification, or a formal_object_declaration is not
called a stand-alone object.
-
(9) The type of a stand-alone object cannot be abstract, See section 3.9.3 Abstract Types and Subprograms.
Examples
-
Example of a multiple object declaration:
-
-- the multiple object declaration
-
John, Paul : Person_Name := new Person(Sex => M); -- See section 3.10.1 Incomplete Type Declarations
-
-- is equivalent to the two single object
-- declarations in the order given
-
John : Person_Name := new Person(Sex => M);
Paul : Person_Name := new Person(Sex => M);
-
Examples of variable declarations:
-
Count, Sum : Integer;
Size : Integer range 0 .. 10_000 := 0;
Sorted : Boolean := False;
Color_Table : array(1 .. Max) of Color;
Option : Bit_Vector(1 .. 10) := (others => True);
Hello : constant String := "Hi, world.";
-
Examples of constant declarations:
-
Limit : constant Integer := 10_000;
Low_Limit : constant Integer := Limit/10;
Tolerance : constant Real := Dispersion(1.15);