6.4.1 Parameter Associations
A parameter association defines 
the association between an actual parameter and a formal parameter. 
 
Name Resolution Rules
If the mode is 
in, the actual is interpreted 
as an 
expression; 
otherwise, the actual is interpreted only as a 
name, 
if possible. 
 
Legality Rules
If the mode is 
in out or 
out, the actual 
shall be a 
name 
that denotes a variable. 
 
  If the mode is out, the actual parameter 
is a view conversion, and the type of the formal parameter is an access 
type or a scalar type that has the Default_Value aspect specified, then 
there shall exist a type (other than a root numeric 
type) that is an ancestor of both the target type and the operand type; 
and
in the case of a scalar type, the type of the operand 
of the conversion shall have the Default_Value aspect specified. 
  In addition to the places where 
Legality Rules normally apply (see 
12.3), 
these rules also apply in the private part of an instance of a generic 
unit.
 
If the formal parameter 
is an explicitly aliased parameter, the type of the actual parameter 
shall be tagged or the actual parameter shall be an aliased view of an 
object. Further, if the formal parameter subtype F is untagged:
the subtype F shall statically match the 
nominal subtype of the actual object; or
the subtype F shall be unconstrained, discriminated 
in its full view, and unconstrained in any partial view. 
  In addition to the places where 
Legality Rules normally apply (see 
12.3), 
these rules also apply in the private part of an instance of a generic 
unit.
 
  In a function call, the accessibility level of 
the actual object for each explicitly aliased parameter shall not be 
statically deeper than the accessibility level of the master of the call 
(see 
3.10.2).
 
  Two 
names 
are 
known to denote the same object if:
 
both 
names 
statically denote the same stand-alone object or parameter; or
 
both 
names 
are dereferences (implicit or explicit) and the dereferenced 
names 
are known to denote the same object; or
 
both 
names 
are 
indexed_components, 
their 
prefixes 
are known to denote the same object, and each of the pairs of corresponding 
index values are either both static expressions with the same static 
value or both 
names 
that are known to denote the same object; or
 
both 
names 
are 
slices, 
their 
prefixes 
are known to denote the same object, and the two 
slices 
have statically matching index constraints; or
 
one of the two 
names 
statically denotes a renaming declaration whose renamed 
object_name 
is known to denote the same object as the other, the 
prefix 
of any dereference within the renamed 
object_name 
is not a variable, and any 
expression 
within the renamed 
object_name 
contains no references to variables nor calls on nonstatic functions. 
 
   Two 
names 
are 
known to refer to the same object if 
 
The two 
names 
are known to denote the same object; or
 
One of the two 
names 
statically denotes a renaming declaration whose renamed 
object_name 
is known to refer to the same object as the other 
name. 
 
   If a call C 
has two or more parameters of mode in out or out that are 
of an elementary type, then the call is legal only if:
For each 
name 
N that is passed as a parameter of mode 
in out or 
out 
to the call 
C, there is no other 
name 
among the other parameters of mode 
in out or 
out to 
C 
that is known to denote the same object.
 
   If a construct 
C 
has two or more direct constituents that are 
names 
or 
expressions 
whose evaluation may occur in an arbitrary order, at least one of which 
contains a function call with an 
in out or 
out parameter, 
then the construct is legal only if:
 
For each name 
N that is passed as a parameter 
of mode 
in out or 
out to some inner function call 
C2 
(not including the construct 
C itself), there is no other 
name 
anywhere within a direct constituent of the construct 
C other 
than the one containing 
C2, that is known to refer to the same 
object. 
 
   For the purposes 
of checking this rule:
For a call, any 
default_expression 
evaluated as part of the call is considered part of the call. 
 
Dynamic Semantics
The actual parameter is first evaluated.
For an access parameter, the 
access_definition 
is elaborated, which creates the anonymous access type.
 
For a parameter (of any mode) that is passed by 
reference (see 
6.2), a view conversion of the 
actual parameter to the nominal subtype of the formal parameter is evaluated, 
and the formal parameter denotes that conversion. 
 
For an 
in or 
in out 
parameter that is passed by copy (see 
6.2), 
the formal parameter object is created, and the value of the actual parameter 
is converted to the nominal subtype of the formal parameter and assigned 
to the formal. 
 
For an out 
parameter that is passed by copy, the formal parameter object is created, 
and: 
For an access type, the formal parameter 
is initialized from the value of the actual, without checking that the 
value satisfies any constraint, any predicate, or any exclusion of the 
null value; 
For a scalar type that has the Default_Value 
aspect specified, the formal parameter is initialized from the value 
of the actual, without checking that the value satisfies any constraint 
or any predicate. Furthermore, if the actual parameter is a view conversion 
and either
there exists no type (other than a root 
numeric type) that is an ancestor of both the target type and the type 
of the operand of the conversion; or
the Default_Value aspect is unspecified 
for the type of the operand of the conversion 
then Program_Error is raised;
 
For a composite type with discriminants 
or that has implicit initial values for any subcomponents (see 
3.3.1), 
the behavior is as for an 
in out parameter passed by copy. 
 
For any other type, the formal parameter 
is uninitialized. If composite, a view conversion of the actual parameter 
to the nominal subtype of the formal is evaluated (which might raise 
Constraint_Error), and the actual subtype of the formal is that of the 
view conversion. If elementary, the actual subtype of the formal is given 
by its nominal subtype. 
In a function call, for each explicitly aliased 
parameter, a check is made that the accessibility level of the master 
of the actual object is not deeper than that of the  master of the call 
(see 
3.10.2). 
 
A formal 
parameter of mode 
in out or 
out with discriminants is constrained 
if either its nominal subtype or the actual parameter is constrained.
 
After 
normal completion and leaving of a subprogram, for each 
in out 
or 
out parameter that is passed by copy, the value of the formal 
parameter is converted to the subtype of the variable given as the actual 
parameter and assigned to it. 
These conversions and 
assignments occur in an arbitrary order.
  
Erroneous Execution
 If the nominal subtype of a 
formal parameter with discriminants is constrained or indefinite, and 
the parameter is passed by reference, then the execution of the call 
is erroneous if the value of any discriminant of the actual is changed 
while the formal parameter exists (that is, before leaving the corresponding 
callable construct). 
 
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe