]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify that result parameters are always zeroed before the function executes.
authorRob Pike <r@golang.org>
Sat, 12 Jun 2010 04:30:03 +0000 (21:30 -0700)
committerRob Pike <r@golang.org>
Sat, 12 Jun 2010 04:30:03 +0000 (21:30 -0700)
R=golang-dev
CC=golang-dev
https://golang.org/cl/1641043

doc/go_spec.html

index 9e0994707ee513565d5925fa61d87f7a6b27bcac..e2637d96cdc7fe9ed7ed1b4bbce5dc2e665ebe2c 100644 (file)
@@ -4190,8 +4190,7 @@ func complex_f2() (re float, im float) {
        </li>
        <li>The expression list may be empty if the functions's result
                type specifies names for its result parameters (§<a href="#Function_Types">Function Types</a>).
-               The result parameters act as ordinary local variables that are
-               initialized to the zero values for their type (§<a href="#The_zero_value">The zero value</a>)
+               The result parameters act as ordinary local variables
                and the function may assign values to them as necessary.
                The "return" statement returns the values of these variables.
 <pre>
@@ -4204,6 +4203,10 @@ func complex_f3() (re float, im float) {
        </li>
 </ol>
 
+<p>
+Regardless of how they are declared, all the result values are initialized to the zero values for their type (§<a href="#The_zero_value">The zero value</a>) upon entry to the function.
+</p>
+
 <!---
 <p>
 <span class="alert">