home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / lrm / chap06.err < prev    next >
Encoding:
Text File  |  1988-05-03  |  9.3 KB  |  200 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                             Errata for changes to Chapter 6 version 21
  7.  
  8.  
  9.  
  10.  
  11. 6.2  Formal Parameter Modes (paragraph 6)6.2  Formal Parameter Modes (paragraph 6)6.2  Formal Parameter Modes (paragraph 6)
  12.  
  13.  
  14. For a scalar parameter, the above effects are achieved by copy:  at the start of each call, if the
  15. mode is ininin or ininin outoutout, the value of the actual parameter  is  copied  into  the  associated  formal
  16. parameter;  then after normal completion of the subprogram body, if the mode is ininin outoutout or outoutout, the
  17. value  of  the  formal  parameter  is  copied  back  into  the associated actual parameter.  For a
  18. parameter whose type is an access type, copy-in is used for all three modes, and copy-back for the
  19. modes ininin outoutout and outoutout.
  20.  
  21.  
  22.  
  23. 6.2  Formal Parameter Modes (paragraph 7)6.2  Formal Parameter Modes (paragraph 7)6.2  Formal Parameter Modes (paragraph 7)
  24.  
  25.  
  26. For a parameter whose type is an array, record, or  task  type,  an  implementation  may  likewise
  27. achieve  the  above  effects  by  copy,  as  for scalar types.  In addition, if copy is used for a
  28. parameter of mode outoutout, then copy-in is required at least for the bounds and discriminants  of  the
  29. actual  parameter and of its subcomponents, and also for each subcomponent whose type is an access
  30. type.  Alternatively, an implementation may achieve  these  effects  by  reference,  that  is,  by
  31. arranging  that every use of the formal parameter (to read or to update its value) be treated as a
  32. use of the associated actual parameter, throughout the execution  of  the  subprogram  call.   The
  33. language does not define which of these two mechanisms is to be adopted for parameter passing, nor
  34. whether  different calls to the same subprogram are to use the same mechanism.  The execution of a
  35. program is erroneous if its effect depends on which mechanism is selected by  the  implementation.
  36.  
  37.  
  38.  
  39. 6.2  Formal Parameter Modes (paragraph 10)6.2  Formal Parameter Modes (paragraph 10)6.2  Formal Parameter Modes (paragraph 10)
  40.  
  41.  
  42. If the actual parameter of a subprogram call is a subcomponent that depends on discriminants of an
  43. unconstrained  record variable, then the execution of the call is erroneous if the value of any of
  44. the discriminants of the variable is changed by this execution;  this rule does not apply  if  the
  45. mode is ininin and the type of the subcomponent is a scalar type or an access type.
  46.  
  47.  
  48.  
  49.  
  50. 6.2  Formal Parameter Modes (paragraph 15)6.2  Formal Parameter Modes (paragraph 15)6.2  Formal Parameter Modes (paragraph 15)
  51.  
  52.  
  53. For  all  modes,  if  an  actual  parameter  designates  a  task,  the associated formal parameter
  54. designates the same task;  the same holds for a  subcomponent  of  an  actual  parameter  and  the
  55. corresponding subcomponent of the associated formal parameter.
  56.  
  57.  
  58.  
  59. 6.3.1  Conformance Rules (paragraphs 2 3)6.3.1  Conformance Rules (paragraphs 2 3)6.3.1  Conformance Rules (paragraphs 2 3)
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. -1                                                        Conformance Rules (paragraphs 2 3) 6.3.1
  68.  
  69.  
  70.  
  71.  
  72.   -  A numeric literal can be replaced by a different numeric literal if and only if both have the
  73.      same value.
  74.  
  75.   -  A simple name can be replaced by an expanded name in which this simple name is the  selector,
  76.      if  and  only  if  at  both  places  the  meaning  of  the  simple  name is given by the same
  77.      declaration.
  78.  
  79.   -  A string literal given as an operator symbol can be replaced by a different string literal if
  80.      and only if both represent the same operator.
  81.  
  82.  
  83.  
  84. 6.3.1  Conformance Rules (paragraph 8)6.3.1  Conformance Rules (paragraph 8)6.3.1  Conformance Rules (paragraph 8)
  85.  
  86.  
  87. References:___________ actual parameter 6.4 6.4.1, allow 1.6, comment 2.7, declaration 3.1, deferred constant
  88. 7.4.3, direct visibility 8.3, discriminant part 3.7.1,  expanded  name  4.1.3,  formal  part  6.1,
  89. lexical element 2, name 4.1, numeric literal 2.4, operator symbol 6.1, overloading 6.6 8.7, prefix
  90. 4.1, selected component 4.1.3, selector 4.1.3, simple name 4.1, subprogram specification 6.1, type
  91. conversion 4.6, visibility 8.3
  92.  
  93.  
  94.  
  95. 6.3.2  Inline Expansion of Subprograms (paragraph 1)6.3.2  Inline Expansion of Subprograms (paragraph 1)6.3.2  Inline Expansion of Subprograms (paragraph 1)
  96.  
  97.  
  98. The  pragma INLINE is used to indicate that inline expansion of the subprogram body is desired for
  99. every call of each of the named subprograms.  The form of this pragma is as follows:
  100.  
  101.  
  102.  
  103.  
  104. 6.4  Subprogram Calls (6)6.4  Subprogram Calls (6)6.4  Subprogram Calls (6)
  105.  
  106.  
  107. The parameter associations of a subprogram call are evaluated in some order that is not defined by
  108. the language.  Similarly, the language rules do not define in which order the values of ininin outoutout  or
  109. outoutout parameters are copied back into the corresponding actual parameters (when this is done).
  110.  
  111.  
  112.  
  113. 6.4.1  Parameter Associations (paragraphs 7)6.4.1  Parameter Associations (paragraphs 7)6.4.1  Parameter Associations (paragraphs 7)
  114.  
  115.  
  116.  
  117.   -  After (normal) completion of the subprogram body:  for a parameter of mode ininin outoutout or outoutout,  it
  118.      is  checked  that  the  value  of  the  formal parameter belongs to the subtype of the actual
  119.      variable.  In the case of a type conversion, the value of the formal parameter  is  converted
  120.      back and the check applies to the result of the conversion.
  121.  
  122.  
  123.  
  124.  
  125. 6.5  Function Subprograms6.5  Function Subprograms6.5  Function Subprograms
  126.  
  127.  
  128. The  exception  PROGRAM_ERROR  is  raised  if  a  function body is left otherwise than by a return
  129. statement.  This does not apply if the execution of the function is abandoned as a  result  of  an
  130.  
  131.  
  132.  
  133. 6.5 Function Subprograms                                                                        -2
  134.  
  135.  
  136.  
  137.  
  138. exception.
  139.  
  140.  
  141.  
  142.  
  143. 6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragraph 4)6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragraph 4)6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragr
  144.  
  145.  
  146. Examples of overloaded subprograms:___________________________________
  147.  
  148.     procedureprocedureprocedure PUT(X : INTEGER);
  149.     procedureprocedureprocedure PUT(X : STRING);
  150.  
  151.  
  152.  
  153. 6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragraph 7)6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragraph 7)6.6  Parameter and Result Type Profile - Overloading of Subprograms (paragr
  154.  
  155.  
  156. Ambiguities  may  (but  need  not)  arise  when  actual  parameters  of  the call of an overloaded
  157. subprogram are themselves overloaded function calls, literals,  or  aggregates.   Ambiguities  may
  158. also  (but need not) arise when several overloaded subprograms belonging to different packages are
  159. visible.  These ambiguities can usually be resolved in several ways:  qualified expressions can be
  160. used for some or all actual parameters, and for the result, if any;  the name  of  the  subprogram
  161. can be expressed more explicitly as an expanded name;  finally, the subprogram can be renamed.
  162.  
  163.  
  164.  
  165.  
  166. 6.7  Overloading of Operators (paragraph 2)6.7  Overloading of Operators (paragraph 2)6.7  Overloading of Operators (paragraph 2)
  167.  
  168.  
  169. The  subprogram  specification  of  a unary operator must have a single parameter.  The subprogram
  170. specification of a binary operator must have two parameters;  for each use of this  operator,  the
  171. first  parameter  takes the left operand as actual parameter, the second parameter takes the right
  172. operand.  Similarly, a generic function instantiation whose designator is an  operator  symbol  is
  173. only  allowed  if  the  specification  of  the  generic  function  has the corresponding number of
  174. parameters.  Default expressions are not allowed for the parameters of an  operator  (whether  the
  175. operator is declared with an explicit subprogram specification or by a generic instantiation).
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. -3                                                      Overloading of Operators (paragraph 2) 6.7
  200.